netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Skip the shutdown routine if the interface is not up
@ 2015-04-26 18:51 Gabriele Mazzotta
  2015-04-27  4:49 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriele Mazzotta @ 2015-04-26 18:51 UTC (permalink / raw)
  Cc: tedd.an-ral2JQCrhuEAvxtiuMwx3w, marcel-kz+m5ild9QBg9hUCZPvPmw,
	gustavo-THi1TnShQwVAfugRpC6u6w,
	johan.hedberg-Re5JQEeQqe8AvxtiuMwx3w,
	linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Gabriele Mazzotta

Most likely, the shutdown routine requires the interface to be up.
This is the case for BTUSB_INTEL: the routine tries to send a command
to the interface, but since this one is down, it fails and exits once
HCI_INIT_TIMEOUT has expired.

Signed-off-by: Gabriele Mazzotta <gabriele.mzt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 net/bluetooth/hci_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 476709b..4663c3d 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1557,7 +1557,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
 {
 	BT_DBG("%s %p", hdev->name, hdev);
 
-	if (!hci_dev_test_flag(hdev, HCI_UNREGISTER)) {
+	if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) &&
+	    test_bit(HCI_UP, &hdev->flags)) {
 		/* Execute vendor specific shutdown routine */
 		if (hdev->shutdown)
 			hdev->shutdown(hdev);
-- 
2.1.4

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

* Re: [PATCH] Bluetooth: Skip the shutdown routine if the interface is not up
  2015-04-26 18:51 [PATCH] Bluetooth: Skip the shutdown routine if the interface is not up Gabriele Mazzotta
@ 2015-04-27  4:49 ` Marcel Holtmann
  2015-04-27  5:01   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2015-04-27  4:49 UTC (permalink / raw)
  To: Gabriele Mazzotta
  Cc: An, Tedd, Gustavo F. Padovan, Johan Hedberg, linux-bluetooth,
	netdev, linux-kernel

Hi Gabriele,

> Most likely, the shutdown routine requires the interface to be up.
> This is the case for BTUSB_INTEL: the routine tries to send a command
> to the interface, but since this one is down, it fails and exits once
> HCI_INIT_TIMEOUT has expired.
> 
> Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
> ---
> net/bluetooth/hci_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 476709b..4663c3d 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -1557,7 +1557,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
> {
> 	BT_DBG("%s %p", hdev->name, hdev);
> 
> -	if (!hci_dev_test_flag(hdev, HCI_UNREGISTER)) {
> +	if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) &&
> +	    test_bit(HCI_UP, &hdev->flags)) {
> 		/* Execute vendor specific shutdown routine */
> 		if (hdev->shutdown)
> 			hdev->shutdown(hdev);

this is a good catch.

Acked-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org # 4.0.x

Dave, do you want to take this patch straight into your stable tree?

Regards

Marcel

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

* Re: [PATCH] Bluetooth: Skip the shutdown routine if the interface is not up
  2015-04-27  4:49 ` Marcel Holtmann
@ 2015-04-27  5:01   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2015-04-27  5:01 UTC (permalink / raw)
  To: marcel
  Cc: gabriele.mzt, tedd.an, gustavo, johan.hedberg, linux-bluetooth,
	netdev, linux-kernel

From: Marcel Holtmann <marcel@holtmann.org>
Date: Sun, 26 Apr 2015 21:49:06 -0700

> Hi Gabriele,
> 
>> Most likely, the shutdown routine requires the interface to be up.
>> This is the case for BTUSB_INTEL: the routine tries to send a command
>> to the interface, but since this one is down, it fails and exits once
>> HCI_INIT_TIMEOUT has expired.
>> 
>> Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
>> ---
>> net/bluetooth/hci_core.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
>> index 476709b..4663c3d 100644
>> --- a/net/bluetooth/hci_core.c
>> +++ b/net/bluetooth/hci_core.c
>> @@ -1557,7 +1557,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
>> {
>> 	BT_DBG("%s %p", hdev->name, hdev);
>> 
>> -	if (!hci_dev_test_flag(hdev, HCI_UNREGISTER)) {
>> +	if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) &&
>> +	    test_bit(HCI_UP, &hdev->flags)) {
>> 		/* Execute vendor specific shutdown routine */
>> 		if (hdev->shutdown)
>> 			hdev->shutdown(hdev);
> 
> this is a good catch.
> 
> Acked-by: Marcel Holtmann <marcel@holtmann.org>
> Cc: stable@vger.kernel.org # 4.0.x
> 
> Dave, do you want to take this patch straight into your stable tree?

Please handle this via the bluetooth tree, thanks.

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

end of thread, other threads:[~2015-04-27  5:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-26 18:51 [PATCH] Bluetooth: Skip the shutdown routine if the interface is not up Gabriele Mazzotta
2015-04-27  4:49 ` Marcel Holtmann
2015-04-27  5:01   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).