diff mbox series

[Linux-kernel-mentees,net] Bluetooth: Fix NULL pointer dereference in amp_read_loc_assoc_final_data()

Message ID 20200808040440.255578-1-yepeilin.cs@gmail.com
State Awaiting Upstream
Delegated to: David Miller
Headers show
Series [Linux-kernel-mentees,net] Bluetooth: Fix NULL pointer dereference in amp_read_loc_assoc_final_data() | expand

Commit Message

Peilin Ye Aug. 8, 2020, 4:04 a.m. UTC
Prevent amp_read_loc_assoc_final_data() from dereferencing `mgr` as NULL.

Reported-and-tested-by: syzbot+f4fb0eaafdb51c32a153@syzkaller.appspotmail.com
Fixes: 9495b2ee757f ("Bluetooth: AMP: Process Chan Selected event")
Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
---
 net/bluetooth/amp.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 9c711f0dfae3..be2d469d6369 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -297,6 +297,9 @@  void amp_read_loc_assoc_final_data(struct hci_dev *hdev,
 	struct hci_request req;
 	int err;
 
+	if (!mgr)
+		return;
+
 	cp.phy_handle = hcon->handle;
 	cp.len_so_far = cpu_to_le16(0);
 	cp.max_len = cpu_to_le16(hdev->amp_assoc_size);