* [PATCH] Bluetooth: Add hci_dev_lock to get/set device flags
@ 2020-06-20 0:10 Abhishek Pandit-Subedi
2020-06-22 7:08 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Abhishek Pandit-Subedi @ 2020-06-20 0:10 UTC (permalink / raw)
To: marcel, linux-bluetooth, mcchou
Cc: chromeos-bluetooth-upstreaming, Abhishek Pandit-Subedi,
David S. Miller, Johan Hedberg, netdev, linux-kernel,
Jakub Kicinski
Adding hci_dev_lock since hci_conn_params_(lookup|add) require this
lock.
Suggested-by: Miao-chen Chou <mcchou@chromium.org>
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
---
net/bluetooth/mgmt.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 2a732cab1dc99d..5e9b9728eeac03 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3895,6 +3895,8 @@ static int get_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
bt_dev_dbg(hdev, "Get device flags %pMR (type 0x%x)\n",
&cp->addr.bdaddr, cp->addr.type);
+ hci_dev_lock(hdev);
+
if (cp->addr.type == BDADDR_BREDR) {
br_params = hci_bdaddr_list_lookup_with_flags(&hdev->whitelist,
&cp->addr.bdaddr,
@@ -3921,6 +3923,8 @@ static int get_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
status = MGMT_STATUS_SUCCESS;
done:
+ hci_dev_unlock(hdev);
+
return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_DEVICE_FLAGS, status,
&rp, sizeof(rp));
}
@@ -3959,6 +3963,8 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
goto done;
}
+ hci_dev_lock(hdev);
+
if (cp->addr.type == BDADDR_BREDR) {
br_params = hci_bdaddr_list_lookup_with_flags(&hdev->whitelist,
&cp->addr.bdaddr,
@@ -3985,6 +3991,8 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
}
done:
+ hci_dev_unlock(hdev);
+
if (status == MGMT_STATUS_SUCCESS)
device_flags_changed(sk, hdev, &cp->addr.bdaddr, cp->addr.type,
supported_flags, current_flags);
--
2.27.0.111.gc72c7da667-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: Add hci_dev_lock to get/set device flags
2020-06-20 0:10 [PATCH] Bluetooth: Add hci_dev_lock to get/set device flags Abhishek Pandit-Subedi
@ 2020-06-22 7:08 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2020-06-22 7:08 UTC (permalink / raw)
To: Abhishek Pandit-Subedi
Cc: Bluetooth Kernel Mailing List, Miao-chen Chou,
ChromeOS Bluetooth Upstreaming, David S. Miller, Johan Hedberg,
netdev, open list, Jakub Kicinski
Hi Abhishek,
> Adding hci_dev_lock since hci_conn_params_(lookup|add) require this
> lock.
>
> Suggested-by: Miao-chen Chou <mcchou@chromium.org>
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> ---
>
> net/bluetooth/mgmt.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-22 7:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-20 0:10 [PATCH] Bluetooth: Add hci_dev_lock to get/set device flags Abhishek Pandit-Subedi
2020-06-22 7:08 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).