Skip to content

Commit 50a3633

Browse files
nielsdosholtmann
authored andcommitted
Bluetooth: use hdev lock in activate_scan for hci_is_adv_monitoring
hci_is_adv_monitoring's function documentation states that it must be called under the hdev lock. Paths that leads to an unlocked call are: discov_update => start_discovery => interleaved_discov => active_scan and: discov_update => start_discovery => active_scan The solution is to take the lock in active_scan during the duration of the call to hci_is_adv_monitoring. Fixes: c32d624 ("Bluetooth: disable filter dup when scan for adv monitor") Signed-off-by: Niels Dossche <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 8b1d66b commit 50a3633

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/bluetooth/hci_request.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,6 +2260,7 @@ static int active_scan(struct hci_request *req, unsigned long opt)
22602260
if (err < 0)
22612261
own_addr_type = ADDR_LE_DEV_PUBLIC;
22622262

2263+
hci_dev_lock(hdev);
22632264
if (hci_is_adv_monitoring(hdev)) {
22642265
/* Duplicate filter should be disabled when some advertisement
22652266
* monitor is activated, otherwise AdvMon can only receive one
@@ -2276,6 +2277,7 @@ static int active_scan(struct hci_request *req, unsigned long opt)
22762277
*/
22772278
filter_dup = LE_SCAN_FILTER_DUP_DISABLE;
22782279
}
2280+
hci_dev_unlock(hdev);
22792281

22802282
hci_req_start_scan(req, LE_SCAN_ACTIVE, interval,
22812283
hdev->le_scan_window_discovery, own_addr_type,

0 commit comments

Comments
 (0)