linux/net/bluetooth
Anmol Karn 5cf3c2e789 Bluetooth: Fix null pointer dereference in hci_event_packet()
[ Upstream commit 6dfccd13db2ff2b709ef60a50163925d477549aa ]

AMP_MGR is getting derefernced in hci_phy_link_complete_evt(), when called
from hci_event_packet() and there is a possibility, that hcon->amp_mgr may
not be found when accessing after initialization of hcon.

- net/bluetooth/hci_event.c:4945
The bug seems to get triggered in this line:

bredr_hcon = hcon->amp_mgr->l2cap_conn->hcon;

Fix it by adding a NULL check for the hcon->amp_mgr before checking the ev-status.

Fixes: d5e911928b ("Bluetooth: AMP: Process Physical Link Complete evt")
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>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-12-30 11:51:05 +01:00
..
bnep
cmtp
hidp
rfcomm
6lowpan.c Bluetooth: add a mutex lock to avoid UAF in do_enale_set 2020-08-19 08:15:59 +02:00
Kconfig
Makefile
a2mp.c Bluetooth: A2MP: Fix not initializing all members 2020-10-17 10:11:22 +02:00
a2mp.h
af_bluetooth.c
amp.c
amp.h
ecdh_helper.c
ecdh_helper.h
hci_conn.c Bluetooth: Disconnect if E0 is used for Level 4 2020-10-17 10:11:22 +02:00
hci_core.c
hci_debugfs.c
hci_debugfs.h
hci_event.c Bluetooth: Fix null pointer dereference in hci_event_packet() 2020-12-30 11:51:05 +01:00
hci_request.c
hci_request.h
hci_sock.c
hci_sysfs.c
l2cap_core.c Bluetooth: L2CAP: Fix calling sk_filter on non-socket based channel 2020-10-17 10:11:22 +02:00
l2cap_sock.c Bluetooth: Only mark socket zapped after unlocking 2020-10-29 09:58:06 +01:00
leds.c
leds.h
lib.c
mgmt.c Bluetooth: MGMT: Fix not checking if BT_HS is enabled 2020-10-17 10:11:22 +02:00
mgmt_util.c
mgmt_util.h
sco.c
selftest.c
selftest.h
smp.c
smp.h