From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+fde6bd779f78e6e0992e@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [bluetooth?] [bcachefs?] KASAN: slab-use-after-free Read in hci_uart_write_work
Date: Tue, 15 Jul 2025 16:31:56 +0800 [thread overview]
Message-ID: <20250715083157.2117-1-hdanton@sina.com> (raw)
In-Reply-To: <687539cb.a70a0220.18f9d4.0005.GAE@google.com>
> Date: Mon, 14 Jul 2025 10:09:31 -0700 [thread overview]
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 3f31a806a62e Merge tag 'mm-hotfixes-stable-2025-07-11-16-1..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=174b07d4580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=b309c907eaab29da
> dashboard link: https://syzkaller.appspot.com/bug?extid=fde6bd779f78e6e0992e
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=127ece8c580000
#syz test
--- x/drivers/bluetooth/hci_ldisc.c
+++ y/drivers/bluetooth/hci_ldisc.c
@@ -100,13 +100,9 @@ static inline struct sk_buff *hci_uart_d
struct sk_buff *skb = hu->tx_skb;
if (!skb) {
- percpu_down_read(&hu->proto_lock);
-
if (test_bit(HCI_UART_PROTO_READY, &hu->flags) ||
test_bit(HCI_UART_PROTO_INIT, &hu->flags))
skb = hu->proto->dequeue(hu);
-
- percpu_up_read(&hu->proto_lock);
} else {
hu->tx_skb = NULL;
}
@@ -154,6 +150,11 @@ static void hci_uart_write_work(struct w
/* REVISIT: should we cope with bad skbs or ->write() returning
* and error value ?
*/
+ percpu_down_read(&hu->proto_lock);
+ if (!test_bit(HCI_UART_PROTO_READY, &hu->flags)) {
+ percpu_up_read(&hu->proto_lock);
+ return;
+ }
restart:
clear_bit(HCI_UART_TX_WAKEUP, &hu->tx_state);
@@ -179,6 +180,7 @@ restart:
if (test_bit(HCI_UART_TX_WAKEUP, &hu->tx_state))
goto restart;
+ percpu_up_read(&hu->proto_lock);
wake_up_bit(&hu->tx_state, HCI_UART_SENDING);
}
@@ -231,9 +233,12 @@ static int hci_uart_flush(struct hci_dev
BT_DBG("hdev %p tty %p", hdev, tty);
+ percpu_down_write(&hu->proto_lock);
if (hu->tx_skb) {
- kfree_skb(hu->tx_skb); hu->tx_skb = NULL;
+ kfree_skb(hu->tx_skb);
+ hu->tx_skb = NULL;
}
+ percpu_up_write(&hu->proto_lock);
/* Flush any pending characters in the driver and discipline. */
tty_ldisc_flush(tty);
--
next prev parent reply other threads:[~2025-07-15 8:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-14 17:09 syzbot
2025-07-15 1:09 ` Hillf Danton
2025-07-15 1:31 ` syzbot
2025-07-15 4:29 ` Hillf Danton
2025-07-15 4:51 ` syzbot
2025-07-15 8:31 ` Hillf Danton [this message]
2025-07-15 9:04 ` syzbot
2025-07-20 17:34 ` Forwarded: syzbot
2025-07-22 2:07 ` Forwarded: Re: [syzbot] [bluetooth?] [bcachefs?] KASAN: slab-use-after-free Read in hci_uart_write_work 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=20250715083157.2117-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+fde6bd779f78e6e0992e@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