linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Fix wrong New Settings event when closing HCI User Channel
@ 2016-09-04  3:13 Marcel Holtmann
  2016-09-06  9:21 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Marcel Holtmann @ 2016-09-04  3:13 UTC (permalink / raw)
  To: linux-bluetooth

When closing HCI User Channel, the New Settings event was send out to
inform about changed settings. However such event is wrong since the
exclusive HCI User Channel access is active until the Index Added event
has been sent.

@ USER Close: test
@ MGMT Event: New Settings (0x0006) plen 4
        Current settings: 0x00000ad0
          Bondable
          Secure Simple Pairing
          BR/EDR
          Low Energy
          Secure Connections
= Close Index: 00:14:EF:22:04:12
@ MGMT Event: Index Added (0x0004) plen 0

Calling __mgmt_power_off from hci_dev_do_close requires an extra check
for an active HCI User Channel.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/bluetooth/hci_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index ddf8432fe8fb..3ac89e9ace71 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1562,6 +1562,7 @@ int hci_dev_do_close(struct hci_dev *hdev)
 	auto_off = hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF);
 
 	if (!auto_off && hdev->dev_type == HCI_PRIMARY &&
+	    !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
 	    hci_dev_test_flag(hdev, HCI_MGMT))
 		__mgmt_power_off(hdev);
 
-- 
2.7.4


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

* Re: [PATCH] Bluetooth: Fix wrong New Settings event when closing HCI User Channel
  2016-09-04  3:13 [PATCH] Bluetooth: Fix wrong New Settings event when closing HCI User Channel Marcel Holtmann
@ 2016-09-06  9:21 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2016-09-06  9:21 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Sun, Sep 04, 2016, Marcel Holtmann wrote:
> When closing HCI User Channel, the New Settings event was send out to
> inform about changed settings. However such event is wrong since the
> exclusive HCI User Channel access is active until the Index Added event
> has been sent.
> 
> @ USER Close: test
> @ MGMT Event: New Settings (0x0006) plen 4
>         Current settings: 0x00000ad0
>           Bondable
>           Secure Simple Pairing
>           BR/EDR
>           Low Energy
>           Secure Connections
> = Close Index: 00:14:EF:22:04:12
> @ MGMT Event: Index Added (0x0004) plen 0
> 
> Calling __mgmt_power_off from hci_dev_do_close requires an extra check
> for an active HCI User Channel.
> 
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  net/bluetooth/hci_core.c | 1 +
>  1 file changed, 1 insertion(+)

Applied to bluetooth-next. Thanks.

Johan

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

end of thread, other threads:[~2016-09-06  9:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-04  3:13 [PATCH] Bluetooth: Fix wrong New Settings event when closing HCI User Channel Marcel Holtmann
2016-09-06  9:21 ` Johan Hedberg

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).