Skip to content

Commit 5517ae2

Browse files
committed
Merge tag 'for-net-2024-08-30' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth
Luiz Augusto von Dentz says: ==================== bluetooth pull request for net: - qca: If memdump doesn't work, re-enable IBS - MGMT: Fix not generating command complete for MGMT_OP_DISCONNECT - Revert "Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE" - MGMT: Ignore keys being loaded with invalid type * tag 'for-net-2024-08-30' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth: Bluetooth: MGMT: Ignore keys being loaded with invalid type Revert "Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE" Bluetooth: MGMT: Fix not generating command complete for MGMT_OP_DISCONNECT Bluetooth: hci_sync: Introduce hci_cmd_sync_run/hci_cmd_sync_run_once Bluetooth: qca: If memdump doesn't work, re-enable IBS ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 646f496 + 1e9683c commit 5517ae2

File tree

7 files changed

+117
-92
lines changed

7 files changed

+117
-92
lines changed

drivers/bluetooth/hci_qca.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,7 @@ static void qca_controller_memdump(struct work_struct *work)
10911091
qca->memdump_state = QCA_MEMDUMP_COLLECTED;
10921092
cancel_delayed_work(&qca->ctrl_memdump_timeout);
10931093
clear_bit(QCA_MEMDUMP_COLLECTION, &qca->flags);
1094+
clear_bit(QCA_IBS_DISABLED, &qca->flags);
10941095
mutex_unlock(&qca->hci_memdump_lock);
10951096
return;
10961097
}

include/net/bluetooth/hci_core.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ struct blocked_key {
186186
struct smp_csrk {
187187
bdaddr_t bdaddr;
188188
u8 bdaddr_type;
189-
u8 link_type;
190189
u8 type;
191190
u8 val[16];
192191
};
@@ -196,7 +195,6 @@ struct smp_ltk {
196195
struct rcu_head rcu;
197196
bdaddr_t bdaddr;
198197
u8 bdaddr_type;
199-
u8 link_type;
200198
u8 authenticated;
201199
u8 type;
202200
u8 enc_size;
@@ -211,16 +209,13 @@ struct smp_irk {
211209
bdaddr_t rpa;
212210
bdaddr_t bdaddr;
213211
u8 addr_type;
214-
u8 link_type;
215212
u8 val[16];
216213
};
217214

218215
struct link_key {
219216
struct list_head list;
220217
struct rcu_head rcu;
221218
bdaddr_t bdaddr;
222-
u8 bdaddr_type;
223-
u8 link_type;
224219
u8 type;
225220
u8 val[HCI_LINK_KEY_SIZE];
226221
u8 pin_len;

include/net/bluetooth/hci_sync.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ int hci_cmd_sync_queue(struct hci_dev *hdev, hci_cmd_sync_work_func_t func,
7373
void *data, hci_cmd_sync_work_destroy_t destroy);
7474
int hci_cmd_sync_queue_once(struct hci_dev *hdev, hci_cmd_sync_work_func_t func,
7575
void *data, hci_cmd_sync_work_destroy_t destroy);
76+
int hci_cmd_sync_run(struct hci_dev *hdev, hci_cmd_sync_work_func_t func,
77+
void *data, hci_cmd_sync_work_destroy_t destroy);
78+
int hci_cmd_sync_run_once(struct hci_dev *hdev, hci_cmd_sync_work_func_t func,
79+
void *data, hci_cmd_sync_work_destroy_t destroy);
7680
struct hci_cmd_sync_work_entry *
7781
hci_cmd_sync_lookup_entry(struct hci_dev *hdev, hci_cmd_sync_work_func_t func,
7882
void *data, hci_cmd_sync_work_destroy_t destroy);

net/bluetooth/hci_conn.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2952,5 +2952,9 @@ int hci_abort_conn(struct hci_conn *conn, u8 reason)
29522952
return 0;
29532953
}
29542954

2955-
return hci_cmd_sync_queue_once(hdev, abort_conn_sync, conn, NULL);
2955+
/* Run immediately if on cmd_sync_work since this may be called
2956+
* as a result to MGMT_OP_DISCONNECT/MGMT_OP_UNPAIR which does
2957+
* already queue its callback on cmd_sync_work.
2958+
*/
2959+
return hci_cmd_sync_run_once(hdev, abort_conn_sync, conn, NULL);
29562960
}

net/bluetooth/hci_sync.c

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static void hci_cmd_sync_add(struct hci_request *req, u16 opcode, u32 plen,
112112
skb_queue_tail(&req->cmd_q, skb);
113113
}
114114

115-
static int hci_cmd_sync_run(struct hci_request *req)
115+
static int hci_req_sync_run(struct hci_request *req)
116116
{
117117
struct hci_dev *hdev = req->hdev;
118118
struct sk_buff *skb;
@@ -169,7 +169,7 @@ struct sk_buff *__hci_cmd_sync_sk(struct hci_dev *hdev, u16 opcode, u32 plen,
169169

170170
hdev->req_status = HCI_REQ_PEND;
171171

172-
err = hci_cmd_sync_run(&req);
172+
err = hci_req_sync_run(&req);
173173
if (err < 0)
174174
return ERR_PTR(err);
175175

@@ -782,6 +782,44 @@ int hci_cmd_sync_queue_once(struct hci_dev *hdev, hci_cmd_sync_work_func_t func,
782782
}
783783
EXPORT_SYMBOL(hci_cmd_sync_queue_once);
784784

785+
/* Run HCI command:
786+
*
787+
* - hdev must be running
788+
* - if on cmd_sync_work then run immediately otherwise queue
789+
*/
790+
int hci_cmd_sync_run(struct hci_dev *hdev, hci_cmd_sync_work_func_t func,
791+
void *data, hci_cmd_sync_work_destroy_t destroy)
792+
{
793+
/* Only queue command if hdev is running which means it had been opened
794+
* and is either on init phase or is already up.
795+
*/
796+
if (!test_bit(HCI_RUNNING, &hdev->flags))
797+
return -ENETDOWN;
798+
799+
/* If on cmd_sync_work then run immediately otherwise queue */
800+
if (current_work() == &hdev->cmd_sync_work)
801+
return func(hdev, data);
802+
803+
return hci_cmd_sync_submit(hdev, func, data, destroy);
804+
}
805+
EXPORT_SYMBOL(hci_cmd_sync_run);
806+
807+
/* Run HCI command entry once:
808+
*
809+
* - Lookup if an entry already exist and only if it doesn't creates a new entry
810+
* and run it.
811+
* - if on cmd_sync_work then run immediately otherwise queue
812+
*/
813+
int hci_cmd_sync_run_once(struct hci_dev *hdev, hci_cmd_sync_work_func_t func,
814+
void *data, hci_cmd_sync_work_destroy_t destroy)
815+
{
816+
if (hci_cmd_sync_lookup_entry(hdev, func, data, destroy))
817+
return 0;
818+
819+
return hci_cmd_sync_run(hdev, func, data, destroy);
820+
}
821+
EXPORT_SYMBOL(hci_cmd_sync_run_once);
822+
785823
/* Lookup HCI command entry:
786824
*
787825
* - Return first entry that matches by function callback or data or

0 commit comments

Comments
 (0)