linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bug 214103] New: HCI_CHANNEL_USER sockets leave device running after exit
@ 2021-08-18 17:45 bugzilla-daemon
  2021-08-23 20:35 ` [Bug 214103] " bugzilla-daemon
  0 siblings, 1 reply; 2+ messages in thread
From: bugzilla-daemon @ 2021-08-18 17:45 UTC (permalink / raw)
  To: linux-bluetooth

https://bugzilla.kernel.org/show_bug.cgi?id=214103

            Bug ID: 214103
           Summary: HCI_CHANNEL_USER sockets leave device running after
                    exit
           Product: Drivers
           Version: 2.5
    Kernel Version: 5.11.0-7620-generic
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Bluetooth
          Assignee: linux-bluetooth@vger.kernel.org
          Reporter: pab@pabigot.com
        Regression: No

Created attachment 298353
  --> https://bugzilla.kernel.org/attachment.cgi?id=298353&action=edit
code to reproduce behavior

HCI_CHANNEL_USER is documented[1] as providing an exclusive (?[2]) Bluetooth
socket channel for application use given CAP_NET_ADMIN. This channel type
requires that the device be down when the socket is bound.  The device
transitions to UP RUNNING as a side-effect of a successful binding.

When the socket is closed and the application exits, the device remains up and
running.  It's unclear whether this is a bug or a feature; in any case it is
not what somebody might expect, as it prevents the application from starting
again without external action to bring the device back down.

Reproducing example attached, and command sequence below.

[1]:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.13.12&id=23500189d7e03a071f0746f43f2cce875a62c91c

[2]: https://bugzilla.kernel.org/show_bug.cgi?id=135431


tirzah[1050]$ sudo hciconfig hci0 down
tirzah[1051]$ hciconfig hci0
hci0:   Type: Primary  Bus: USB
        BD Address: A4:C3:F0:F2:23:E3  ACL MTU: 1021:4  SCO MTU: 96:6
        DOWN 
        RX bytes:64500 acl:0 sco:0 events:4125 errors:0
        TX bytes:650824 acl:0 sco:0 commands:3992 errors:0

tirzah[1052]$ gcc repro.c
tirzah[1053]$ sudo setcap cap_net_raw,cap_net_admin=ep ./a.out
tirzah[1054]$ getcap ./a.out
./a.out = cap_net_admin,cap_net_raw+ep
tirzah[1055]$ ./a.out 
opening device 0
dd=3; binding to user channel
bound to user channel; closing
closed
tirzah[1056]$ hciconfig hci0
hci0:   Type: Primary  Bus: USB
        BD Address: A4:C3:F0:F2:23:E3  ACL MTU: 1021:4  SCO MTU: 96:6
        UP RUNNING 
        RX bytes:65256 acl:0 sco:0 events:4180 errors:0
        TX bytes:653053 acl:0 sco:0 commands:4047 errors:0

tirzah[1057]$

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are the assignee for the bug.

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

* [Bug 214103] HCI_CHANNEL_USER sockets leave device running after exit
  2021-08-18 17:45 [Bug 214103] New: HCI_CHANNEL_USER sockets leave device running after exit bugzilla-daemon
@ 2021-08-23 20:35 ` bugzilla-daemon
  0 siblings, 0 replies; 2+ messages in thread
From: bugzilla-daemon @ 2021-08-23 20:35 UTC (permalink / raw)
  To: linux-bluetooth

https://bugzilla.kernel.org/show_bug.cgi?id=214103

Tedd An (tedd.an@intel.com) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tedd.an@intel.com

--- Comment #1 from Tedd An (tedd.an@intel.com) ---
If the Bluetooth daemon is running, try it after stop/disable the daemon.

If the bluetoothd is required, there is a "AutoEnable" option in
/etc/bluetooth/main.conf. Change the value to false, and restart the daemon.

It will prevent the HCI interface from enabling after socket close.

Regards,
Tedd

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are the assignee for the bug.

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

end of thread, other threads:[~2021-08-23 20:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 17:45 [Bug 214103] New: HCI_CHANNEL_USER sockets leave device running after exit bugzilla-daemon
2021-08-23 20:35 ` [Bug 214103] " bugzilla-daemon

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