Re: [PATCH] Bluetooth: hci_ldisc: Fix another race when closing the tty.
From: Lukas Wunner
Date: Thu Oct 26 2017 - 02:52:11 EST
On Wed, Oct 25, 2017 at 10:15:19PM -0700, =?UTF-8?q?Ronald=20Tschal=C3=A4r?= wrote:
> --- a/drivers/bluetooth/hci_ldisc.c
> +++ b/drivers/bluetooth/hci_ldisc.c
> @@ -523,13 +523,13 @@ static void hci_uart_tty_close(struct tty_struct *tty)
> if (hdev)
> hci_uart_close(hdev);
>
> - cancel_work_sync(&hu->write_work);
> -
> if (test_bit(HCI_UART_PROTO_READY, &hu->flags)) {
> percpu_down_write(&hu->proto_lock);
> clear_bit(HCI_UART_PROTO_READY, &hu->flags);
> percpu_up_write(&hu->proto_lock);
>
> + cancel_work_sync(&hu->write_work);
> +
Now the work is only cancelled if HCI_UART_PROTO_READY is set,
but that seems fine, so
Reviewed-by: Lukas Wunner <lukas@xxxxxxxxx>
It should be noted that this patch only applies cleanly if Ronald's
other patch is applied before.