mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: syzbot <syzbot+b2545b087a01a7319474@syzkaller.appspotmail.com>,
	linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [bluetooth?] WARNING in hci_conn_del
Date: Fri, 14 Jun 2024 11:42:49 +0300	[thread overview]
Message-ID: <0d900a20-0e9a-4b61-844e-df38b10bc4f2@gmail.com> (raw)
In-Reply-To: <000000000000396d68061acddd90@google.com>

[-- Attachment #1: Type: text/plain, Size: 723 bytes --]



On 6/14/24 2:29 AM, syzbot wrote:
> 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)
> 
> 

smells unrelated. let's try again

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

-- 
With regards,
Pavel Skripkin

[-- Attachment #2: 0001-bluetooth-hci-disallow-setting-handle-bigger-than-HC.patch --]
[-- Type: text/x-patch, Size: 1975 bytes --]

From cd75c43796451af0e3c5e6b42aa7276603c4bb1b Mon Sep 17 00:00:00 2001
From: Pavel Skripkin <paskripkin@gmail.com>
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.

Fixes: https://syzkaller.appspot.com/bug?extid=b2545b087a01a7319474
Reported-by: syzbot+b2545b087a01a7319474@syzkaller.appspotmail.com
Fixes: 181a42edddf5 ("Bluetooth: Make handle of hci_conn be unique")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
 net/bluetooth/hci_conn.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 0c76dcde5361..dd21fee1d7c6 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -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)
-- 
2.45.2


  reply	other threads:[~2024-06-14  8:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <c261e607-78da-4536-95e3-114b5d766918@gmail.com>
2024-06-13 23:29 ` syzbot
2024-06-14  8:42   ` Pavel Skripkin [this message]
2024-06-15  3:09     ` syzbot
2024-06-15 21:37     ` Pavel Skripkin
2024-06-16  3:52       ` syzbot
2024-06-16 10:37 [PATCH] bluetooth: handle value within the ida range should not be handled in BIG Pavel Skripkin
2024-06-16 13:18 ` [syzbot] [bluetooth?] WARNING in hci_conn_del Edward Adam Davis
  -- strict thread matches above, loose matches on Subject: below --
2024-02-28  4:53 syzbot
2024-06-16 10:14 ` Edward Adam Davis
2024-06-16 10:33   ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0d900a20-0e9a-4b61-844e-df38b10bc4f2@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+b2545b087a01a7319474@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®