linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH] net: bluetooth: Fix null pointer dereference in hci_event_packet()
@ 2020-09-10  4:34 Anmol Karn
  2020-09-10  5:06 ` Eric Biggers
  2020-09-10 10:49 ` Dan Carpenter
  0 siblings, 2 replies; 12+ messages in thread
From: Anmol Karn @ 2020-09-10  4:34 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: netdev, syzbot+0bef568258653cff272f, syzkaller-bugs,
	linux-kernel, linux-bluetooth, kuba, linux-kernel-mentees, davem

Prevent hci_phy_link_complete_evt() from dereferencing 'hcon->amp_mgr'
as NULL. Fix it by adding pointer check for it.

Reported-and-tested-by: syzbot+0bef568258653cff272f@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=0bef568258653cff272f
Signed-off-by: Anmol Karn <anmol.karan123@gmail.com>
---
 net/bluetooth/hci_event.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 4b7fc430793c..871e16804433 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -4936,6 +4936,11 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev,
 		return;
 	}
 
+	if (IS_ERR_OR_NULL(hcon->amp_mgr)) {
+		hci_dev_unlock(hdev);
+		return;
+	}
+
 	if (ev->status) {
 		hci_conn_del(hcon);
 		hci_dev_unlock(hdev);
-- 
2.28.0
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-10-01  7:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10  4:34 [Linux-kernel-mentees] [PATCH] net: bluetooth: Fix null pointer dereference in hci_event_packet() Anmol Karn
2020-09-10  5:06 ` Eric Biggers
2020-09-10  6:02   ` Anmol Karn
2020-09-10 10:49 ` Dan Carpenter
2020-09-10 14:58   ` Anmol Karn
2020-09-12  9:10   ` Anmol Karn
2020-09-14 15:44     ` Dan Carpenter
2020-09-14 18:37       ` Anmol Karn
2020-09-29 17:32       ` Anmol Karn
2020-09-30 14:18         ` Anmol Karn
2020-10-01  7:06           ` Marcel Holtmann
2020-10-01  7:45             ` Anmol Karn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).