OrangePi_CM5/net/bluetooth
Sungwoo Kim 4373e5def3 UPSTREAM: Bluetooth: L2CAP: Fix u8 overflow
[ Upstream commit bcd70260ef56e0aee8a4fc6cd214a419900b0765 ]

By keep sending L2CAP_CONF_REQ packets, chan->num_conf_rsp increases
multiple times and eventually it will wrap around the maximum number
(i.e., 255).
This patch prevents this by adding a boundary check with
L2CAP_MAX_CONF_RSP

Btmon log:
Bluetooth monitor ver 5.64
= Note: Linux version 6.1.0-rc2 (x86_64)                               0.264594
= Note: Bluetooth subsystem version 2.22                               0.264636
@ MGMT Open: btmon (privileged) version 1.22                  {0x0001} 0.272191
= New Index: 00:00:00:00:00:00 (Primary,Virtual,hci0)          [hci0] 13.877604
@ RAW Open: 9496 (privileged) version 2.22                   {0x0002} 13.890741
= Open Index: 00:00:00:00:00:00                                [hci0] 13.900426
(...)
> ACL Data RX: Handle 200 flags 0x00 dlen 1033             #32 [hci0] 14.273106
        invalid packet size (12 != 1033)
        08 00 01 00 02 01 04 00 01 10 ff ff              ............
> ACL Data RX: Handle 200 flags 0x00 dlen 1547             #33 [hci0] 14.273561
        invalid packet size (14 != 1547)
        0a 00 01 00 04 01 06 00 40 00 00 00 00 00        ........@.....
> ACL Data RX: Handle 200 flags 0x00 dlen 2061             #34 [hci0] 14.274390
        invalid packet size (16 != 2061)
        0c 00 01 00 04 01 08 00 40 00 00 00 00 00 00 04  ........@.......
> ACL Data RX: Handle 200 flags 0x00 dlen 2061             #35 [hci0] 14.274932
        invalid packet size (16 != 2061)
        0c 00 01 00 04 01 08 00 40 00 00 00 07 00 03 00  ........@.......
= bluetoothd: Bluetooth daemon 5.43                                   14.401828
> ACL Data RX: Handle 200 flags 0x00 dlen 1033             #36 [hci0] 14.275753
        invalid packet size (12 != 1033)
        08 00 01 00 04 01 04 00 40 00 00 00              ........@...

Change-Id: Id3b87180787bdded28e876ed0500ca6156579fb8
Signed-off-by: Sungwoo Kim <iam@sung-woo.kim>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f3fe6817156a2ad4b06f01afab04638a34d7c9a6)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-02-06 11:31:45 +00:00
..
bnep
…
cmtp Bluetooth: cmtp: fix possible panic when cmtp_init_sockets() fails 2022-01-27 10:53:45 +01:00
hidp Bluetooth: hidp: use correct wait queue when removing ctrl_wait 2021-08-26 08:35:40 -04:00
rfcomm Bluetooth: Fix passing NULL to PTR_ERR 2022-07-29 17:19:26 +02:00
6lowpan.c Bluetooth: 6LoWPAN: add missing hci_dev_put() in get_l2cap_conn() 2022-12-14 11:32:01 +01:00
Kconfig Bluetooth: Disable High Speed by default 2020-09-25 20:21:55 +02:00
Makefile
…
a2mp.c Bluetooth: drop HCI device reference before return 2021-03-04 11:37:25 +01:00
a2mp.h
…
af_bluetooth.c Bluetooth: Fix not cleanup led when bt_init fails 2022-12-14 11:32:01 +01:00
amp.c Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data 2021-03-07 12:34:10 +01:00
amp.h
…
ecdh_helper.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
ecdh_helper.h Fix misc new gcc warnings 2021-05-11 14:47:36 +02:00
hci_conn.c Bluetooth: use inclusive language in HCI role comments 2022-06-09 10:21:09 +02:00
hci_core.c This is the 5.10.159 stable release 2022-12-14 13:11:31 +01:00
hci_debugfs.c Revert "Bluetooth: use inclusive language when filtering devices" 2022-07-28 14:52:52 +02:00
hci_debugfs.h
…
hci_event.c Revert "Bluetooth: use inclusive language when filtering devices" 2022-07-28 14:52:52 +02:00
hci_request.c Revert "Bluetooth: Interleave with allowlist scan" 2022-07-28 14:52:52 +02:00
hci_request.h
…
hci_sock.c Revert "Bluetooth: use inclusive language when filtering devices" 2022-07-28 14:52:52 +02:00
hci_sysfs.c Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times 2022-10-26 13:25:46 +02:00
l2cap_core.c UPSTREAM: Bluetooth: L2CAP: Fix u8 overflow 2023-02-06 11:31:45 +00:00
l2cap_sock.c Bluetooth: L2CAP: uninitialized variables in l2cap_sock_setsockopt() 2022-01-27 10:54:02 +01:00
leds.c
…
leds.h
…
lib.c
…
mgmt.c Revert "Bluetooth: use inclusive language when filtering devices" 2022-07-28 14:52:52 +02:00
mgmt_config.c Revert "Bluetooth: Interleave with allowlist scan" 2022-07-28 14:52:52 +02:00
mgmt_config.h
…
mgmt_util.c
…
mgmt_util.h
…
msft.c Bluetooth: Replace zero-length array with flexible-array member 2020-10-29 17:22:59 -05:00
msft.h
…
sco.c Bluetooth: SCO: Fix sco_send_frame returning skb->len 2022-07-29 17:19:26 +02:00
selftest.c
…
selftest.h
…
smp.c Bluetooth: use inclusive language in HCI role comments 2022-06-09 10:21:09 +02:00
smp.h
…