diff options
author | Manish Mandlik <mmandlik@google.com> | 2023-08-04 11:14:45 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-09-13 09:42:32 +0200 |
commit | 81d8e9f59df63b8358751c1ffed9f1cf5c796909 (patch) | |
tree | ea90c481d7a6bae27dad03b1e25cec87db2fa4e6 /net | |
parent | bd39b55240475409b0fa7b87e7a850c640b70c3a (diff) | |
download | linux-stable-81d8e9f59df63b8358751c1ffed9f1cf5c796909.tar.gz linux-stable-81d8e9f59df63b8358751c1ffed9f1cf5c796909.tar.bz2 linux-stable-81d8e9f59df63b8358751c1ffed9f1cf5c796909.zip |
Bluetooth: hci_sync: Avoid use-after-free in dbg for hci_add_adv_monitor()
[ Upstream commit a2bcd2b63271a93a695fabbfbf459c603d956d48 ]
KSAN reports use-after-free in hci_add_adv_monitor().
While adding an adv monitor,
hci_add_adv_monitor() calls ->
msft_add_monitor_pattern() calls ->
msft_add_monitor_sync() calls ->
msft_le_monitor_advertisement_cb() calls in an error case ->
hci_free_adv_monitor() which frees the *moniter.
This is referenced by bt_dev_dbg() in hci_add_adv_monitor().
Fix the bt_dev_dbg() by using handle instead of monitor->handle.
Fixes: b747a83690c8 ("Bluetooth: hci_sync: Refactor add Adv Monitor")
Signed-off-by: Manish Mandlik <mmandlik@google.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 561e8a77f64c..146553c0054f 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -1957,7 +1957,7 @@ int hci_add_adv_monitor(struct hci_dev *hdev, struct adv_monitor *monitor) case HCI_ADV_MONITOR_EXT_MSFT: status = msft_add_monitor_pattern(hdev, monitor); bt_dev_dbg(hdev, "add monitor %d msft status %d", - monitor->handle, status); + handle, status); break; } |