* [PATCH 1/2] Bluetooth: hci_h5: Remove ignored flag HCI_UART_RESET_ON_INIT
@ 2020-08-01 16:29 Samuel Holland
2020-08-01 16:29 ` [PATCH 2/2] Bluetooth: hci_ldisc/hci_serdev: Cancel init work before unregistering Samuel Holland
2020-08-02 18:02 ` [PATCH 1/2] Bluetooth: hci_h5: Remove ignored flag HCI_UART_RESET_ON_INIT Marcel Holtmann
0 siblings, 2 replies; 4+ messages in thread
From: Samuel Holland @ 2020-08-01 16:29 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg
Cc: Gustavo Padovan, Hans de Goede, linux-bluetooth, linux-kernel,
Samuel Holland
Since commit cba736465e5c ("Bluetooth: hci_serdev: Remove setting of
HCI_QUIRK_RESET_ON_CLOSE."), this flag is ignored for hci_serdev users,
so let's remove setting it.
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
drivers/bluetooth/hci_h5.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index e41854e0d79a..981d96cc7695 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -793,8 +793,6 @@ static int h5_serdev_probe(struct serdev_device *serdev)
if (!h5)
return -ENOMEM;
- set_bit(HCI_UART_RESET_ON_INIT, &h5->serdev_hu.hdev_flags);
-
h5->hu = &h5->serdev_hu;
h5->serdev_hu.serdev = serdev;
serdev_device_set_drvdata(serdev, h5);
--
2.26.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] Bluetooth: hci_ldisc/hci_serdev: Cancel init work before unregistering
2020-08-01 16:29 [PATCH 1/2] Bluetooth: hci_h5: Remove ignored flag HCI_UART_RESET_ON_INIT Samuel Holland
@ 2020-08-01 16:29 ` Samuel Holland
2020-08-02 18:02 ` Marcel Holtmann
2020-08-02 18:02 ` [PATCH 1/2] Bluetooth: hci_h5: Remove ignored flag HCI_UART_RESET_ON_INIT Marcel Holtmann
1 sibling, 1 reply; 4+ messages in thread
From: Samuel Holland @ 2020-08-01 16:29 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg
Cc: Gustavo Padovan, Hans de Goede, linux-bluetooth, linux-kernel,
Samuel Holland
If hci_uart_tty_close() or hci_uart_unregister_device() is called while
hu->init_ready is scheduled, hci_register_dev() could be called after
the hci_uart is torn down. Avoid this by ensuring the work is complete
or canceled before checking the HCI_UART_REGISTERED flag.
Fixes: 9f2aee848fe6 ("Bluetooth: Add delayed init sequence support for UART controllers")
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
drivers/bluetooth/hci_ldisc.c | 1 +
drivers/bluetooth/hci_serdev.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 85a30fb9177b..f83d67eafc9f 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -538,6 +538,7 @@ static void hci_uart_tty_close(struct tty_struct *tty)
clear_bit(HCI_UART_PROTO_READY, &hu->flags);
percpu_up_write(&hu->proto_lock);
+ cancel_work_sync(&hu->init_ready);
cancel_work_sync(&hu->write_work);
if (hdev) {
diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c
index 7b233312e723..3977bba485c2 100644
--- a/drivers/bluetooth/hci_serdev.c
+++ b/drivers/bluetooth/hci_serdev.c
@@ -355,6 +355,8 @@ void hci_uart_unregister_device(struct hci_uart *hu)
struct hci_dev *hdev = hu->hdev;
clear_bit(HCI_UART_PROTO_READY, &hu->flags);
+
+ cancel_work_sync(&hu->init_ready);
if (test_bit(HCI_UART_REGISTERED, &hu->flags))
hci_unregister_dev(hdev);
hci_free_dev(hdev);
--
2.26.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] Bluetooth: hci_ldisc/hci_serdev: Cancel init work before unregistering
2020-08-01 16:29 ` [PATCH 2/2] Bluetooth: hci_ldisc/hci_serdev: Cancel init work before unregistering Samuel Holland
@ 2020-08-02 18:02 ` Marcel Holtmann
0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2020-08-02 18:02 UTC (permalink / raw)
To: Samuel Holland
Cc: Johan Hedberg, Gustavo Padovan, Hans de Goede,
Bluetooth Kernel Mailing List, linux-kernel
Hi Samuel,
> If hci_uart_tty_close() or hci_uart_unregister_device() is called while
> hu->init_ready is scheduled, hci_register_dev() could be called after
> the hci_uart is torn down. Avoid this by ensuring the work is complete
> or canceled before checking the HCI_UART_REGISTERED flag.
>
> Fixes: 9f2aee848fe6 ("Bluetooth: Add delayed init sequence support for UART controllers")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> drivers/bluetooth/hci_ldisc.c | 1 +
> drivers/bluetooth/hci_serdev.c | 2 ++
> 2 files changed, 3 insertions(+)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] Bluetooth: hci_h5: Remove ignored flag HCI_UART_RESET_ON_INIT
2020-08-01 16:29 [PATCH 1/2] Bluetooth: hci_h5: Remove ignored flag HCI_UART_RESET_ON_INIT Samuel Holland
2020-08-01 16:29 ` [PATCH 2/2] Bluetooth: hci_ldisc/hci_serdev: Cancel init work before unregistering Samuel Holland
@ 2020-08-02 18:02 ` Marcel Holtmann
1 sibling, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2020-08-02 18:02 UTC (permalink / raw)
To: Samuel Holland
Cc: Johan Hedberg, Gustavo Padovan, Hans de Goede, linux-bluetooth,
linux-kernel
Hi Samuel,
> Since commit cba736465e5c ("Bluetooth: hci_serdev: Remove setting of
> HCI_QUIRK_RESET_ON_CLOSE."), this flag is ignored for hci_serdev users,
> so let's remove setting it.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> drivers/bluetooth/hci_h5.c | 2 --
> 1 file changed, 2 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-02 18:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01 16:29 [PATCH 1/2] Bluetooth: hci_h5: Remove ignored flag HCI_UART_RESET_ON_INIT Samuel Holland
2020-08-01 16:29 ` [PATCH 2/2] Bluetooth: hci_ldisc/hci_serdev: Cancel init work before unregistering Samuel Holland
2020-08-02 18:02 ` Marcel Holtmann
2020-08-02 18:02 ` [PATCH 1/2] Bluetooth: hci_h5: Remove ignored flag HCI_UART_RESET_ON_INIT Marcel Holtmann
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.