[Bug 214103] New: HCI_CHANNEL_USER sockets leave device running after exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx
          Reporter: pab@xxxxxxxxxxx
        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.



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux