[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <5E7BFFAA-B248-4C94-87FB-0E824D04C1BC@holtmann.org>
Date: Fri, 18 Dec 2020 22:26:09 +0100
From: Marcel Holtmann <marcel@...tmann.org>
To: Claire Chang <tientzu@...omium.org>
Cc: Johan Hedberg <johan.hedberg@...il.com>,
Luiz Augusto von Dentz <luiz.dentz@...il.com>,
robh@...nel.org, sre@...nel.org, Pavel Machek <pavel@....cz>,
linux-bluetooth@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Bluetooth: hci_uart: Fix a race for write_work scheduling
Hi Claire,
> In hci_uart_write_work, there is a loop/goto checking the value of
> HCI_UART_TX_WAKEUP. If HCI_UART_TX_WAKEUP is set again, it keeps trying
> hci_uart_dequeue; otherwise, it clears HCI_UART_SENDING and returns.
>
> In hci_uart_tx_wakeup, if HCI_UART_SENDING is already set, it sets
> HCI_UART_TX_WAKEUP, skips schedule_work and assumes the running/pending
> hci_uart_write_work worker will do hci_uart_dequeue properly.
>
> However, if the HCI_UART_SENDING check in hci_uart_tx_wakeup is done after
> the loop breaks, but before HCI_UART_SENDING is cleared in
> hci_uart_write_work, the schedule_work is skipped incorrectly.
>
> Fix this race by changing the order of HCI_UART_SENDING and
> HCI_UART_TX_WAKEUP modification.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Fixes: 82f5169bf3d3 ("Bluetooth: hci_uart: add serdev driver support library")
> Signed-off-by: Claire Chang <tientzu@...omium.org>
> ---
> drivers/bluetooth/hci_ldisc.c | 7 +++----
> drivers/bluetooth/hci_serdev.c | 4 ++--
> 2 files changed, 5 insertions(+), 6 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
Powered by blists - more mailing lists