From: syzbot <syzbot+da2717d5c64bf7975268@syzkaller.appspotmail.com>
To: wuyankun@uniontech.com
Cc: syzkaller-bugs@googlegroups.com, wuyankun@uniontech.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: hci_uart: serialize close flush with write_work
Date: Thu, 14 May 2026 03:08:00 -0700 [thread overview]
Message-ID: <6a059f00.170a0220.290639.01c6.GAE@google.com> (raw)
In-Reply-To: <20260514100742.830572-1-wuyankun@uniontech.com>
> Please test this patch.
>
> #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
This crash does not have a reproducer. I cannot test it.
>
> From 48d953a6ee4c2e4e1e58cdf7da3d3647316e4802 Mon Sep 17 00:00:00 2001
> From: wuyankun <wuyankun@uniontech.com>
> Date: Sat, 9 May 2026 15:41:19 +0800
> Subject: [PATCH] Bluetooth: hci_uart: serialize close flush with write_work
>
> hci_uart_close() calls hci_uart_flush(), and flush may free hu->tx_skb.
> At the same time, hci_uart_write_work() can still be running and access
> the same skb (for example through skb_pull()), which leads to a
> use-after-free.
>
> Fix this by canceling write_work before calling hci_uart_flush(), so the
> tx_skb lifetime is fully serialized against the TX worker.
>
> Reported-by: syzbot+da2717d5c64bf7975268@syzkaller.appspotmail.com
> Link: https://syzkaller.appspot.com/bug?extid=da2717d5c64bf7975268
> Cc: stable@vger.kernel.org
> Signed-off-by: wuyankun <wuyankun@uniontech.com>
> ---
> drivers/bluetooth/hci_ldisc.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
> index 275ea865bc29..51cc9af0f7e8 100644
> --- a/drivers/bluetooth/hci_ldisc.c
> +++ b/drivers/bluetooth/hci_ldisc.c
> @@ -263,8 +263,11 @@ static int hci_uart_open(struct hci_dev *hdev)
> /* Close device */
> static int hci_uart_close(struct hci_dev *hdev)
> {
> + struct hci_uart *hu = hci_get_drvdata(hdev);
> BT_DBG("hdev %p", hdev);
>
> + /* Ensure write_work is not touching tx_skb while flush frees it. */
> + cancel_work_sync(&hu->write_work);
> hci_uart_flush(hdev);
> hdev->flush = NULL;
> return 0;
> --
> 2.20.1
>
next parent reply other threads:[~2026-05-14 10:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260514100742.830572-1-wuyankun@uniontech.com>
2026-05-14 10:08 ` syzbot [this message]
2026-05-09 8:31 [PATCH] Bluetooth: hci_uart: serialize close flush with write_work wuyankun
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=6a059f00.170a0220.290639.01c6.GAE@google.com \
--to=syzbot+da2717d5c64bf7975268@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
--cc=wuyankun@uniontech.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.