Skip to contentSkip to conversation

WARNING in hci_conn_del

syzbot syzbot 2 participants 5 messages Jun 13, 2024 – Jun 16, 2024 1 message not in the archive Bluetooth

lore
Share & tools
lore

syzbot

author syzbot
#1 lore raw
In reply to a message not in the archive

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
SYZFAIL: NL802154_CMD_SET_SHORT_ADDR failed

2024/06/13 23:28:26 ignoring optional flag "sandboxArg"="0"
2024/06/13 23:28:27 parsed 1 programs
2024/06/13 23:28:27 [FATAL] failed to run ["./syz-executor" "setup" "fault" "binfmt_misc" "usb" "802154" "swap"]: exit status 67 mkdir(/syzcgroup) failed: 17
mount(binfmt_misc) failed: 16
SYZFAIL: NL802154_CMD_SET_SHORT_ADDR failed
(errno 16: Device or resource busy)

Tested on:

commit:         d20f6b3d Merge tag 'net-6.10-rc4' of git://git.kernel...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=108934a2980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=fa0ce06dcc735711
dashboard link: https://syzkaller.appspot.com/bug?extid=b2545b087a01a7319474
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=13f923e2980000
#2 lore raw
Quoted 5 lines · syzbot

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
SYZFAIL: NL802154_CMD_SET_SHORT_ADDR failed

Quoted 9 lines

2024/06/13 23:28:26 ignoring optional flag "sandboxArg"="0"
2024/06/13 23:28:27 parsed 1 programs
2024/06/13 23:28:27 [FATAL] failed to run ["./syz-executor" "setup" "fault" "binfmt_misc" "usb" "802154" "swap"]: exit status 67 mkdir(/syzcgroup) failed: 17
mount(binfmt_misc) failed: 16
SYZFAIL: NL802154_CMD_SET_SHORT_ADDR failed
(errno 16: Device or resource busy)

smells unrelated. let's try again

#syz test
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git maste

Signature · 2 lines
With regards,
Pavel Skripkin

From cd75c43796451af0e3c5e6b42aa7276603c4bb1b Mon Sep 17 00:00:00 2001
From: Pavel Skripkin <[email protected]>
Date: Fri, 14 Jun 2024 00:02:51 +0300
Subject: [PATCH] bluetooth/hci: disallow setting handle bigger than
HCI_CONN_HANDLE_MAX

Syzbot hit warning in hci_conn_del() caused by freeing handle that was not allocated using ida allocator.

This is caused by handle bigger than HCI_CONN_HANDLE_MAX passed by hci_le_big_sync_established_evt(), which makes code think it's unset connection.

Add same check for handle upper bound as in hci_conn_set_handle() to prevent warning.

Reported-by [email protected]
Fixes 181a42edddf5 ("Bluetooth: Make handle of hci_conn be unique")
---
 net/bluetooth/hci_conn.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
net/bluetooth/hci_conn.c +11 -2
index 0c76dcde5361..dd21fee1d7c6 100644
@@ -899,8 +899,8 @@ static int hci_conn_hash_alloc_unset(struct hci_dev *hdev)
 			       U16_MAX, GFP_ATOMIC);
 }
 
-struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst,
-			      u8 role, u16 handle)
+static struct hci_conn *__hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst,
+				       u8 role, u16 handle)
 {
 	struct hci_conn *conn;
 
@@ -1044,6 +1044,15 @@ struct hci_conn *hci_conn_add_unset(struct hci_dev *hdev, int type,
 	return hci_conn_add(hdev, type, dst, role, handle);
 }
 
+struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst,
+			      u8 role, u16 handle)
+{
+	if (handle > HCI_CONN_HANDLE_MAX)
+		return ERR_PTR(-EINVAL);
+
+	return __hci_conn_add(hdev, type, dst, role, handle);
+}
+
 static void hci_conn_cleanup_child(struct hci_conn *conn, u8 reason)
 {
 	if (!reason)
Signature · 1 line
2.45.2
author syzbot
#3 lore raw
syzbot has tested the proposed patch but the reproducer is still triggering an issue: SYZFAIL: NL802154_CMD_SET_SHORT_ADDR failed

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
SYZFAIL: NL802154_CMD_SET_SHORT_ADDR failed

2024/06/15 03:08:49 ignoring optional flag "sandboxArg"="0"
2024/06/15 03:08:49 parsed 1 programs
2024/06/15 03:08:49 [FATAL] failed to run ["./syz-executor" "setup" "fault" "binfmt_misc" "usb" "802154" "swap"]: exit status 67 mkdir(/syzcgroup) failed: 17
mount(binfmt_misc) failed: 16
SYZFAIL: NL802154_CMD_SET_SHORT_ADDR failed
(errno 16: Device or resource busy)

Tested on:

commit:         c286c21f Merge tag 'block-6.10-20240614' of git://git...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=144e93fe980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=fa0ce06dcc735711
dashboard link: https://syzkaller.appspot.com/bug?extid=b2545b087a01a7319474
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=14d0aede980000
#4 lore raw
In reply to Pavel Skripkin
Quoted 8 lines · Pavel Skripkin
Quoted 5 lines · syzbot

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
SYZFAIL: NL802154_CMD_SET_SHORT_ADDR failed

Quoted 9 lines
Quoted 9 lines

2024/06/13 23:28:26 ignoring optional flag "sandboxArg"="0"
2024/06/13 23:28:27 parsed 1 programs
2024/06/13 23:28:27 [FATAL] failed to run ["./syz-executor" "setup" "fault" "binfmt_misc" "usb" "802154" "swap"]: exit status 67 mkdir(/syzcgroup) failed: 17
mount(binfmt_misc) failed: 16
SYZFAIL: NL802154_CMD_SET_SHORT_ADDR failed
(errno 16: Device or resource busy)

#syz test
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

Signature · 2 lines
With regards,
Pavel Skripkin

From cd75c43796451af0e3c5e6b42aa7276603c4bb1b Mon Sep 17 00:00:00 2001
From: Pavel Skripkin <[email protected]>
Date: Fri, 14 Jun 2024 00:02:51 +0300
Subject: [PATCH] bluetooth/hci: disallow setting handle bigger than
HCI_CONN_HANDLE_MAX

Syzbot hit warning in hci_conn_del() caused by freeing handle that was not allocated using ida allocator.

This is caused by handle bigger than HCI_CONN_HANDLE_MAX passed by hci_le_big_sync_established_evt(), which makes code think it's unset connection.

Add same check for handle upper bound as in hci_conn_set_handle() to prevent warning.

Reported-by [email protected]
Fixes 181a42edddf5 ("Bluetooth: Make handle of hci_conn be unique")
---
 net/bluetooth/hci_conn.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
net/bluetooth/hci_conn.c +11 -2
index 0c76dcde5361..dd21fee1d7c6 100644
@@ -899,8 +899,8 @@ static int hci_conn_hash_alloc_unset(struct hci_dev *hdev)
 			       U16_MAX, GFP_ATOMIC);
 }
 
-struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst,
-			      u8 role, u16 handle)
+static struct hci_conn *__hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst,
+				       u8 role, u16 handle)
 {
 	struct hci_conn *conn;
 
@@ -1044,6 +1044,15 @@ struct hci_conn *hci_conn_add_unset(struct hci_dev *hdev, int type,
 	return hci_conn_add(hdev, type, dst, role, handle);
 }
 
+struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst,
+			      u8 role, u16 handle)
+{
+	if (handle > HCI_CONN_HANDLE_MAX)
+		return ERR_PTR(-EINVAL);
+
+	return __hci_conn_add(hdev, type, dst, role, handle);
+}
+
 static void hci_conn_cleanup_child(struct hci_conn *conn, u8 reason)
 {
 	if (!reason)
Signature · 1 line
2.45.2
author syzbot
#5 lore raw
syzbot has tested the proposed patch but the reproducer is still triggering an issue: SYZFAIL: NL802154_CMD_SET_SHORT_ADDR failed

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
SYZFAIL: NL802154_CMD_SET_SHORT_ADDR failed

2024/06/16 03:50:59 ignoring optional flag "sandboxArg"="0"
2024/06/16 03:50:59 parsed 1 programs
2024/06/16 03:50:59 [FATAL] failed to run ["./syz-executor" "setup" "fault" "binfmt_misc" "usb" "802154" "swap"]: exit status 67 mkdir(/syzcgroup) failed: 17
mount(binfmt_misc) failed: 16
SYZFAIL: NL802154_CMD_SET_SHORT_ADDR failed
(errno 16: Device or resource busy)

Tested on:

commit:         a3e18a54 Merge tag 'xfs-6.10-fixes-3' of git://git.ker..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=145ccbfe980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=fa0ce06dcc735711
dashboard link: https://syzkaller.appspot.com/bug?extid=b2545b087a01a7319474
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=130eb12e980000