From: syzbot <syzbot+03d6270b6425df1605bf@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Read in set_powered_sync
Date: Fri, 04 Oct 2024 06:56:50 -0700 [thread overview]
Message-ID: <66fff422.050a0220.49194.048b.GAE@google.com> (raw)
In-Reply-To: <000000000000932e45061d45f6e8@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Read in set_powered_sync
Author: dmantipov@yandex.ru
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git b63c755cb65d43c8aba987c4f6b57c77c6f123f2
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index bab1e3d7452a..492723a22e68 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -345,6 +345,7 @@ enum {
HCI_UP,
HCI_INIT,
HCI_RUNNING,
+ HCI_CLOSING,
HCI_PSCAN,
HCI_ISCAN,
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 629c302f7407..95f55cfb6da6 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -501,12 +501,16 @@ int hci_dev_close(__u16 dev)
goto done;
}
+ set_bit(HCI_CLOSING, &hdev->flags);
+
cancel_work_sync(&hdev->power_on);
if (hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF))
cancel_delayed_work(&hdev->power_off);
err = hci_dev_do_close(hdev);
+ if (unlikely(err))
+ clear_bit(HCI_CLOSING, &hdev->flags);
done:
hci_dev_put(hdev);
return err;
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 2272e1849ebd..ff43718822d4 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -1671,6 +1671,11 @@ static int hci_mgmt_cmd(struct hci_mgmt_chan *chan, struct sock *sk,
goto done;
}
+ if (unlikely(test_bit(HCI_CLOSING, &hdev->flags))) {
+ err = -ENODEV;
+ goto done;
+ }
+
if (hci_dev_test_flag(hdev, HCI_SETUP) ||
hci_dev_test_flag(hdev, HCI_CONFIG) ||
hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) {
next prev parent reply other threads:[~2024-10-04 13:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-15 9:36 [syzbot] [bluetooth?] KASAN: slab-use-after-free Read in set_powered_sync syzbot
2024-09-08 9:07 ` syzbot
2024-11-16 0:56 ` Hillf Danton
2024-11-16 1:23 ` syzbot
2024-11-16 3:00 ` Hillf Danton
2024-11-16 3:28 ` syzbot
2024-09-08 16:43 ` syzbot
2024-10-03 14:28 ` Qianqiang Liu
2024-10-03 14:45 ` syzbot
2024-10-03 15:41 ` Qianqiang Liu
2024-10-03 16:22 ` syzbot
2024-10-03 16:45 ` Qianqiang Liu
2024-10-03 16:54 ` Luiz Augusto von Dentz
2024-10-03 17:15 ` Qianqiang Liu
2024-10-04 20:50 ` Luiz Augusto von Dentz
2024-10-04 20:54 ` syzbot
2024-10-03 17:13 ` syzbot
2024-10-04 13:56 ` syzbot [this message]
2024-11-15 16:42 ` [syzbot] Re: [PATCH v1] Bluetooth: MGMT: Fix " syzbot
2024-11-15 18:41 ` syzbot
2024-11-18 16:04 ` [syzbot] Re: [PATCH v3] " syzbot
2024-11-18 17:00 ` syzbot
2024-11-18 20:50 ` [syzbot] Re: [PATCH v5] " 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=66fff422.050a0220.49194.048b.GAE@google.com \
--to=syzbot+03d6270b6425df1605bf@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--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