linux/net/bluetooth
Ruihan Li 2333dbc88f bluetooth: Add cmd validity checks at the start of hci_sock_ioctl()
commit 000c2fa2c1 upstream.

Previously, channel open messages were always sent to monitors on the first
ioctl() call for unbound HCI sockets, even if the command and arguments
were completely invalid. This can leave an exploitable hole with the abuse
of invalid ioctl calls.

This commit hardens the ioctl processing logic by first checking if the
command is valid, and immediately returning with an ENOIOCTLCMD error code
if it is not. This ensures that ioctl calls with invalid commands are free
of side effects, and increases the difficulty of further exploitation by
forcing exploitation to find a way to pass a valid command first.

Signed-off-by: Ruihan Li <lrh2000@pku.edu.cn>
Co-developed-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Dragos-Marian Panait <dragos.panait@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-05 09:26:21 +02:00
..
bnep
cmtp
hidp Bluetooth: Fix race condition in hidp_session_thread 2023-04-20 12:35:06 +02:00
rfcomm
6lowpan.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
a2mp.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
a2mp.h
af_bluetooth.c
amp.c
amp.h
aosp.c
aosp.h
ecdh_helper.c
ecdh_helper.h
eir.c
eir.h
hci_codec.c
hci_codec.h
hci_conn.c Bluetooth: Fix printing errors if LE Connection times out 2023-04-20 12:35:09 +02:00
hci_core.c Bluetooth: hci_core: Detect if an ACL packet is in fact an ISO packet 2023-03-30 12:49:10 +02:00
hci_debugfs.c
hci_debugfs.h
hci_event.c Bluetooth: Add new quirk for broken local ext features page 2 2023-05-24 17:32:39 +01:00
hci_request.c
hci_request.h
hci_sock.c bluetooth: Add cmd validity checks at the start of hci_sock_ioctl() 2023-06-05 09:26:21 +02:00
hci_sync.c Bluetooth: Add new quirk for broken set random RPA timeout for ATS2851 2023-05-24 17:32:40 +01:00
hci_sysfs.c
iso.c Bluetooth: ISO: fix timestamped HCI ISO data packet parsing 2023-03-30 12:49:10 +02:00
Kconfig
l2cap_core.c Bluetooth: L2CAP: fix "bad unlock balance" in l2cap_disconnect_rsp 2023-05-24 17:32:40 +01:00
l2cap_sock.c Bluetooth: L2CAP: Fix potential user-after-free 2023-03-10 09:33:01 +01:00
leds.c
leds.h
lib.c
Makefile
mgmt_config.c
mgmt_config.h
mgmt_util.c
mgmt_util.h
mgmt.c Bluetooth: mgmt: Fix MGMT add advmon with RSSI command 2023-03-30 12:49:12 +02:00
msft.c
msft.h
sco.c Bluetooth: SCO: Fix possible circular locking dependency sco_sock_getsockopt 2023-04-20 12:35:09 +02:00
selftest.c
selftest.h
smp.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
smp.h