diff options
author | Niels Dossche <dossche.niels@gmail.com> | 2022-04-23 00:31:17 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-12 16:35:07 +0200 |
commit | 5781bb8a31910c2621cddeed739b99bfb0ddf1aa (patch) | |
tree | 3acc451b37cf7918a8ddbda605aa700a95db3a70 /net/bluetooth | |
parent | 8a2dbdeccef6de47565638abdf3c25f41cdffc37 (diff) | |
download | linux-stable-5781bb8a31910c2621cddeed739b99bfb0ddf1aa.tar.gz linux-stable-5781bb8a31910c2621cddeed739b99bfb0ddf1aa.tar.bz2 linux-stable-5781bb8a31910c2621cddeed739b99bfb0ddf1aa.zip |
Bluetooth: protect le accept and resolv lists with hdev->lock
[ Upstream commit 5e2b6064cbc5fd582396768c5f9583f65085e368 ]
Concurrent operations from events on le_{accept,resolv}_list are
currently unprotected by hdev->lock.
Most existing code do already protect the lists with that lock.
This can be observed in hci_debugfs and hci_sync.
Add the protection for these events too.
Fixes: b950aa88638c ("Bluetooth: Add definitions and track LE resolve list modification")
Fixes: 0f36b589e4ee ("Bluetooth: Track LE white list modification via HCI commands")
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>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_event.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 5ac3aca6deeb..2337e9275863 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -1559,7 +1559,9 @@ static void hci_cc_le_clear_accept_list(struct hci_dev *hdev, if (status) return; + hci_dev_lock(hdev); hci_bdaddr_list_clear(&hdev->le_accept_list); + hci_dev_unlock(hdev); } static void hci_cc_le_add_to_accept_list(struct hci_dev *hdev, @@ -1577,8 +1579,10 @@ static void hci_cc_le_add_to_accept_list(struct hci_dev *hdev, if (!sent) return; + hci_dev_lock(hdev); hci_bdaddr_list_add(&hdev->le_accept_list, &sent->bdaddr, sent->bdaddr_type); + hci_dev_unlock(hdev); } static void hci_cc_le_del_from_accept_list(struct hci_dev *hdev, @@ -1596,8 +1600,10 @@ static void hci_cc_le_del_from_accept_list(struct hci_dev *hdev, if (!sent) return; + hci_dev_lock(hdev); hci_bdaddr_list_del(&hdev->le_accept_list, &sent->bdaddr, sent->bdaddr_type); + hci_dev_unlock(hdev); } static void hci_cc_le_read_supported_states(struct hci_dev *hdev, @@ -1661,9 +1667,11 @@ static void hci_cc_le_add_to_resolv_list(struct hci_dev *hdev, if (!sent) return; + hci_dev_lock(hdev); hci_bdaddr_list_add_with_irk(&hdev->le_resolv_list, &sent->bdaddr, sent->bdaddr_type, sent->peer_irk, sent->local_irk); + hci_dev_unlock(hdev); } static void hci_cc_le_del_from_resolv_list(struct hci_dev *hdev, @@ -1681,8 +1689,10 @@ static void hci_cc_le_del_from_resolv_list(struct hci_dev *hdev, if (!sent) return; + hci_dev_lock(hdev); hci_bdaddr_list_del_with_irk(&hdev->le_resolv_list, &sent->bdaddr, sent->bdaddr_type); + hci_dev_unlock(hdev); } static void hci_cc_le_clear_resolv_list(struct hci_dev *hdev, @@ -1695,7 +1705,9 @@ static void hci_cc_le_clear_resolv_list(struct hci_dev *hdev, if (status) return; + hci_dev_lock(hdev); hci_bdaddr_list_clear(&hdev->le_resolv_list); + hci_dev_unlock(hdev); } static void hci_cc_le_read_resolv_list_size(struct hci_dev *hdev, |