]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
Bluetooth: hci_uart: clear HCI_UART_SENDING when write_work is canceled
authorPauli Virtanen <pav@iki.fi>
Sat, 13 Jun 2026 18:43:37 +0000 (21:43 +0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 6 Jul 2026 13:49:59 +0000 (09:49 -0400)
commit1b0d946d6f08bd39211385bc703a440911b41e46
tree723c3023d3842dbf7fd7961a29aebc28b43a4c21
parent9e05e91a9a847ed57926414bd7c2c5e54d6c56c6
Bluetooth: hci_uart: clear HCI_UART_SENDING when write_work is canceled

HCI_UART_SENDING bit in tx_state means write_work is pending and blocks
queueing it again.  Currently this bit is not cleared when canceling the
work in hci_uart_close(), which blocks future writes when device is
reopened later if write_work was pending.

Fix by clearing HCI_UART_SENDING when canceling the work.

Also make clearing of tx_skb safe by using disable_work_sync +
enable_work instead of just cancel_work_sync.  hci_uart_flush() purges
the proto tx queue so we can cancel the pending write_work there,
instead of doing it just in hci_uart_close().  Re-enable and possibly
requeue the work after queue flush.

Fixes: c1bb9336ae6b ("Bluetooth: hci_uart: fix UAFs and race conditions in close and init paths")
Link: https://lore.kernel.org/linux-bluetooth/07e0a28650773abec711ee492fdb1bf5d21a6c98.camel@iki.fi/
Cc: stable@vger.kernel.org
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/hci_ldisc.c