All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Call shutdown for HCI_USER_CHANNEL
@ 2022-08-30  2:58 Abhishek Pandit-Subedi
  2022-08-30  3:44 ` bluez.test.bot
  2022-09-02  0:54 ` [PATCH] " Abhishek Pandit-Subedi
  0 siblings, 2 replies; 3+ messages in thread
From: Abhishek Pandit-Subedi @ 2022-08-30  2:58 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Abhishek Pandit-Subedi, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Johan Hedberg, Luiz Augusto von Dentz,
	Marcel Holtmann, Paolo Abeni, linux-kernel, netdev

From: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>

Some drivers depend on shutdown being called for proper operation.
There's no reason to restrict this from being called when using
HCI_USER_CHANNEL.

Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
---
This is easy to reproduce on QCA6174-A, which uses the hci_qca driver.
Simply open the socket, bind as userchannel and close again. It will
succeed the first time and fail the second time (because shutdown wasn't
called). A similar bug also occurs with btmtksdio (using MT7921).

Question for maintainers: What is a driver supposed to be doing during
shutdown? We should add some documentation to `struct hci_dev` to
clarify.


 net/bluetooth/hci_sync.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index e08c0503027d..be78fd708f16 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -4680,7 +4680,6 @@ int hci_dev_close_sync(struct hci_dev *hdev)
 	}
 
 	if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) &&
-	    !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
 	    test_bit(HCI_UP, &hdev->flags)) {
 		/* Execute vendor specific shutdown routine */
 		if (hdev->shutdown)
-- 
2.37.2.672.g94769d06f0-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: Bluetooth: Call shutdown for HCI_USER_CHANNEL
  2022-08-30  2:58 [PATCH] Bluetooth: Call shutdown for HCI_USER_CHANNEL Abhishek Pandit-Subedi
@ 2022-08-30  3:44 ` bluez.test.bot
  2022-09-02  0:54 ` [PATCH] " Abhishek Pandit-Subedi
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-08-30  3:44 UTC (permalink / raw)
  To: linux-bluetooth, abhishekpandit

[-- Attachment #1: Type: text/plain, Size: 1154 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=672250

---Test result---

Test Summary:
CheckPatch                    PASS      1.82 seconds
GitLint                       PASS      0.76 seconds
SubjectPrefix                 PASS      0.61 seconds
BuildKernel                   PASS      40.97 seconds
BuildKernel32                 PASS      34.06 seconds
Incremental Build with patchesPASS      51.14 seconds
TestRunner: Setup             PASS      570.93 seconds
TestRunner: l2cap-tester      PASS      18.81 seconds
TestRunner: iso-tester        PASS      18.14 seconds
TestRunner: bnep-tester       PASS      7.05 seconds
TestRunner: mgmt-tester       PASS      113.87 seconds
TestRunner: rfcomm-tester     PASS      11.04 seconds
TestRunner: sco-tester        PASS      10.56 seconds
TestRunner: smp-tester        PASS      10.38 seconds
TestRunner: userchan-tester   PASS      7.54 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: Call shutdown for HCI_USER_CHANNEL
  2022-08-30  2:58 [PATCH] Bluetooth: Call shutdown for HCI_USER_CHANNEL Abhishek Pandit-Subedi
  2022-08-30  3:44 ` bluez.test.bot
@ 2022-09-02  0:54 ` Abhishek Pandit-Subedi
  1 sibling, 0 replies; 3+ messages in thread
From: Abhishek Pandit-Subedi @ 2022-09-02  0:54 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Abhishek Pandit-Subedi, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Johan Hedberg, Luiz Augusto von Dentz,
	Marcel Holtmann, Paolo Abeni, linux-kernel, netdev

Please avoid merging.

After additional testing, I've found a problem with btusb->shutdown
not working for Intel controllers.

btusb_shutdown_intel uses __hci_sync_cmd(...) to send the command and
the command complete will not get captured because it is using hci
user channel. We'll need a more invasive change to remove the
userchannel flag during close so that the stack can properly clean up.


On Mon, Aug 29, 2022 at 7:58 PM Abhishek Pandit-Subedi
<abhishekpandit@google.com> wrote:
>
> From: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
>
> Some drivers depend on shutdown being called for proper operation.
> There's no reason to restrict this from being called when using
> HCI_USER_CHANNEL.
>
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> ---
> This is easy to reproduce on QCA6174-A, which uses the hci_qca driver.
> Simply open the socket, bind as userchannel and close again. It will
> succeed the first time and fail the second time (because shutdown wasn't
> called). A similar bug also occurs with btmtksdio (using MT7921).
>
> Question for maintainers: What is a driver supposed to be doing during
> shutdown? We should add some documentation to `struct hci_dev` to
> clarify.
>
>
>  net/bluetooth/hci_sync.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index e08c0503027d..be78fd708f16 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -4680,7 +4680,6 @@ int hci_dev_close_sync(struct hci_dev *hdev)
>         }
>
>         if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) &&
> -           !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
>             test_bit(HCI_UP, &hdev->flags)) {
>                 /* Execute vendor specific shutdown routine */
>                 if (hdev->shutdown)
> --
> 2.37.2.672.g94769d06f0-goog
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-02  0:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-30  2:58 [PATCH] Bluetooth: Call shutdown for HCI_USER_CHANNEL Abhishek Pandit-Subedi
2022-08-30  3:44 ` bluez.test.bot
2022-09-02  0:54 ` [PATCH] " Abhishek Pandit-Subedi

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.