diff mbox series

bluetooth: handle value within the ida range should not be handled in BIG

Message ID tencent_880C74B1776566183DC9363096E037A64A09@qq.com
State New
Headers show
Series bluetooth: handle value within the ida range should not be handled in BIG | expand

Commit Message

Edward Adam Davis June 16, 2024, 10:20 a.m. UTC
hci_le_big_sync_established_evt is necessary to filter out cases where the handle
value is belone to ida id range, otherwise ida will be erroneously released in 
hci_conn_cleanup. 

Fixes: 181a42edddf5 ("Bluetooth: Make handle of hci_conn be unique")
Reported-by: syzbot+b2545b087a01a7319474@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
 net/bluetooth/hci_event.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Pavel Skripkin June 16, 2024, 10:37 a.m. UTC | #1
On 6/16/24 1:20 PM, 'Edward Adam Davis' via syzkaller-bugs wrote:
> hci_le_big_sync_established_evt is necessary to filter out cases where the handle
> value is belone to ida id range, otherwise ida will be erroneously released in
> hci_conn_cleanup.
> 
> Fixes: 181a42edddf5 ("Bluetooth: Make handle of hci_conn be unique")
> Reported-by: syzbot+b2545b087a01a7319474@syzkaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---

There is one more user of  `hci_conn_add` which may pass too big handle 
which is `hci_le_cis_req_evt`.

I think, it should be resolved on API level as I tried to test here [0], 
but syzbot is feeling bad for some reason


[0] 
https://lore.kernel.org/all/31ac448d-2a21-4e93-8a00-5c7090970452@gmail.com/

>   net/bluetooth/hci_event.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index a487f9df8145..4130d64d9a80 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -6893,6 +6893,9 @@ static void hci_le_big_sync_established_evt(struct hci_dev *hdev, void *data,
>   
>   		bis = hci_conn_hash_lookup_handle(hdev, handle);
>   		if (!bis) {
> +                        if (handle > HCI_CONN_HANDLE_MAX)
> +                               continue;
> +
>   			bis = hci_conn_add(hdev, ISO_LINK, BDADDR_ANY,
>   					   HCI_ROLE_SLAVE, handle);
>   			if (IS_ERR(bis))
diff mbox series

Patch

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index a487f9df8145..4130d64d9a80 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -6893,6 +6893,9 @@  static void hci_le_big_sync_established_evt(struct hci_dev *hdev, void *data,
 
 		bis = hci_conn_hash_lookup_handle(hdev, handle);
 		if (!bis) {
+                        if (handle > HCI_CONN_HANDLE_MAX)
+                               continue;
+
 			bis = hci_conn_add(hdev, ISO_LINK, BDADDR_ANY,
 					   HCI_ROLE_SLAVE, handle);
 			if (IS_ERR(bis))