Bluetooth: use hdev lock in activate_scan for hci_is_adv_monitoring
authorNiels Dossche <dossche.niels@gmail.com>
Thu, 7 Apr 2022 18:06:52 +0000 (20:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:22:58 +0000 (10:22 +0200)
commitab00f8c6b14ed8360fc2c40bd2ec61c6477e2ddb
treeb3e4dcd2fc2e80b9c47e4996791bba4efaacaceb
parent65d347cb39e2e6bd0c2a745ad7c928998ebb0162
Bluetooth: use hdev lock in activate_scan for hci_is_adv_monitoring

[ Upstream commit 50a3633ae5e98cf1b80ef5b73c9e341aee9ad896 ]

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: c32d624640fd ("Bluetooth: disable filter dup when scan for adv monitor")
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/hci_request.c