android_kernel_motorola_sm6375/net/bluetooth
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Fedor Pchelkin a9a7672fc1 Bluetooth: L2CAP: handle NULL sock pointer in l2cap_sock_alloc
commit 5f397409f8ee5bc82901eeaf799e1cbc4f8edcf1 upstream.

A NULL sock pointer is passed into l2cap_sock_alloc() when it is called
from l2cap_sock_new_connection_cb() and the error handling paths should
also be aware of it.

Seemingly a more elegant solution would be to swap bt_sock_alloc() and
l2cap_chan_create() calls since they are not interdependent to that moment
but then l2cap_chan_create() adds the soon to be deallocated and still
dummy-initialized channel to the global list accessible by many L2CAP
paths. The channel would be removed from the list in short period of time
but be a bit more straight-forward here and just check for NULL instead of
changing the order of function calls.

Found by Linux Verification Center (linuxtesting.org) with SVACE static
analysis tool.

Fixes: 7c4f78cdb8e7 ("Bluetooth: L2CAP: do not leave dangling sk pointer on error in l2cap_sock_create()")
Cc: stable@vger.kernel.org
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-13 12:43:07 +01:00
..
bnep Bluetooth: bnep: fix wild-memory-access in proto_unregister 2024-11-08 16:20:50 +01:00
cmtp
hidp
rfcomm Bluetooth: Fix type of len in rfcomm_sock_getsockopt{,_old}() 2024-12-14 19:44:36 +01:00
6lowpan.c
a2mp.c
a2mp.h
af_bluetooth.c Bluetooth: Remove debugfs directory on module init failure 2024-11-08 16:20:48 +01:00
amp.c
amp.h
ecdh_helper.c
ecdh_helper.h
hci_conn.c
hci_core.c Bluetooth: hci_core: Fix LE quote calculation 2024-09-04 13:14:59 +02:00
hci_debugfs.c
hci_debugfs.h
hci_event.c
hci_request.c Bluetooth: Fix memory leak in hci_req_sync_complete() 2024-05-02 16:18:28 +02:00
hci_request.h
hci_sock.c
hci_sysfs.c
Kconfig
l2cap_core.c Bluetooth: l2cap: always unlock channel in l2cap_conless_channel() 2024-08-19 05:33:46 +02:00
l2cap_sock.c Bluetooth: L2CAP: handle NULL sock pointer in l2cap_sock_alloc 2025-03-13 12:43:07 +01:00
leds.c
leds.h
lib.c
Makefile
mgmt.c Bluetooth: MGMT: Add error handling to pair_device() 2024-09-04 13:15:01 +02:00
mgmt_util.c
mgmt_util.h
sco.c Bluetooth: Fix use-after-free bugs caused by sco_sock_timeout 2024-05-17 11:43:53 +02:00
selftest.c
selftest.h
smp.c
smp.h