1. 30 7月, 2020 1 次提交
  2. 16 7月, 2020 1 次提交
    • P
      Bluetooth: Fix update of connection state in `hci_encrypt_cfm` · 339ddaa6
      Patrick Steinhardt 提交于
      Starting with the upgrade to v5.8-rc3, I've noticed I wasn't able to
      connect to my Bluetooth headset properly anymore. While connecting to
      the device would eventually succeed, bluetoothd seemed to be confused
      about the current connection state where the state was flapping hence
      and forth. Bisecting this issue led to commit 3ca44c16 (Bluetooth:
      Consolidate encryption handling in hci_encrypt_cfm, 2020-05-19), which
      refactored `hci_encrypt_cfm` to also handle updating the connection
      state.
      
      The commit in question changed the code to call `hci_connect_cfm` inside
      `hci_encrypt_cfm` and to change the connection state. But with the
      conversion, we now only update the connection state if a status was set
      already. In fact, the reverse should be true: the status should be
      updated if no status is yet set. So let's fix the isuse by reversing the
      condition.
      
      Fixes: 3ca44c16 ("Bluetooth: Consolidate encryption handling in hci_encrypt_cfm")
      Signed-off-by: NPatrick Steinhardt <ps@pks.im>
      Acked-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      339ddaa6
  3. 07 7月, 2020 1 次提交
  4. 23 6月, 2020 1 次提交
    • L
      Bluetooth: Disconnect if E0 is used for Level 4 · 8746f135
      Luiz Augusto von Dentz 提交于
      E0 is not allowed with Level 4:
      
      BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 3, Part C page 1319:
      
        '128-bit equivalent strength for link and encryption keys
         required using FIPS approved algorithms (E0 not allowed,
         SAFER+ not allowed, and P-192 not allowed; encryption key
         not shortened'
      
      SC enabled:
      
      > HCI Event: Read Remote Extended Features (0x23) plen 13
              Status: Success (0x00)
              Handle: 256
              Page: 1/2
              Features: 0x0b 0x00 0x00 0x00 0x00 0x00 0x00 0x00
                Secure Simple Pairing (Host Support)
                LE Supported (Host)
                Secure Connections (Host Support)
      > HCI Event: Encryption Change (0x08) plen 4
              Status: Success (0x00)
              Handle: 256
              Encryption: Enabled with AES-CCM (0x02)
      
      SC disabled:
      
      > HCI Event: Read Remote Extended Features (0x23) plen 13
              Status: Success (0x00)
              Handle: 256
              Page: 1/2
              Features: 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00
                Secure Simple Pairing (Host Support)
                LE Supported (Host)
      > HCI Event: Encryption Change (0x08) plen 4
              Status: Success (0x00)
              Handle: 256
              Encryption: Enabled with E0 (0x01)
      [May 8 20:23] Bluetooth: hci0: Invalid security: expect AES but E0 was used
      < HCI Command: Disconnect (0x01|0x0006) plen 3
              Handle: 256
              Reason: Authentication Failure (0x05)
      Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      8746f135
  5. 18 6月, 2020 8 次提交
  6. 12 6月, 2020 1 次提交
  7. 20 5月, 2020 1 次提交
  8. 13 5月, 2020 2 次提交
  9. 11 5月, 2020 1 次提交
  10. 15 4月, 2020 1 次提交
  11. 05 4月, 2020 2 次提交
  12. 12 3月, 2020 4 次提交
  13. 08 3月, 2020 1 次提交
  14. 15 2月, 2020 1 次提交
  15. 16 1月, 2020 1 次提交
  16. 04 1月, 2020 1 次提交
  17. 05 9月, 2019 1 次提交
  18. 17 8月, 2019 1 次提交
  19. 06 7月, 2019 1 次提交
  20. 25 4月, 2019 1 次提交
  21. 25 1月, 2019 1 次提交
  22. 29 9月, 2018 1 次提交
    • M
      Bluetooth: Fix debugfs NULL pointer dereference · 30d65e08
      Matias Karhumaa 提交于
      Fix crash caused by NULL pointer dereference when debugfs functions
      le_max_key_read, le_max_key_size_write, le_min_key_size_read or
      le_min_key_size_write and Bluetooth adapter was powered off.
      
      Fix is to move max_key_size and min_key_size from smp_dev to hci_dev.
      At the same time they were renamed to le_max_key_size and
      le_min_key_size.
      
      BUG: unable to handle kernel NULL pointer dereference at 00000000000002e8
      PGD 0 P4D 0
      Oops: 0000 [#24] SMP PTI
      CPU: 2 PID: 6255 Comm: cat Tainted: G      D    OE     4.18.9-200.fc28.x86_64 #1
      Hardware name: LENOVO 4286CTO/4286CTO, BIOS 8DET76WW (1.46 ) 06/21/2018
      RIP: 0010:le_max_key_size_read+0x45/0xb0 [bluetooth]
      Code: 00 00 00 48 83 ec 10 65 48 8b 04 25 28 00 00 00 48 89 44 24 08 31 c0 48 8b 87 c8 00 00 00 48 8d 7c 24 04 48 8b 80 48 0a 00 00 <48> 8b 80 e8 02 00 00 0f b6 48 52 e8 fb b6 b3 ed be 04 00 00 00 48
      RSP: 0018:ffffab23c3ff3df0 EFLAGS: 00010246
      RAX: 0000000000000000 RBX: 00007f0b4ca2e000 RCX: ffffab23c3ff3f08
      RDX: ffffffffc0ddb033 RSI: 0000000000000004 RDI: ffffab23c3ff3df4
      RBP: 0000000000020000 R08: 0000000000000000 R09: 0000000000000000
      R10: ffffab23c3ff3ed8 R11: 0000000000000000 R12: ffffab23c3ff3f08
      R13: 00007f0b4ca2e000 R14: 0000000000020000 R15: ffffab23c3ff3f08
      FS:  00007f0b4ca0f540(0000) GS:ffff91bd5e280000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000000000002e8 CR3: 00000000629fa006 CR4: 00000000000606e0
      Call Trace:
       full_proxy_read+0x53/0x80
       __vfs_read+0x36/0x180
       vfs_read+0x8a/0x140
       ksys_read+0x4f/0xb0
       do_syscall_64+0x5b/0x160
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      Signed-off-by: NMatias Karhumaa <matias.karhumaa@gmail.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      30d65e08
  23. 27 9月, 2018 1 次提交
  24. 30 7月, 2018 5 次提交
    • J
      Bluetooth: Implement Set ADV set random address · a73c046a
      Jaganath Kanakkassery 提交于
      This basically sets the random address for the adv instance
      Random address can be set only if the instance is created which
      is done in Set ext adv param.
      
      Random address and rpa expire timer and flags have been added
      to adv instance which will be used when the respective
      instance is scheduled.
      
      This introduces a hci_get_random_address() which returns the
      own address type and random address (rpa or nrpa) based
      on the instance flags and hdev flags. New function is required
      since own address type should be known before setting adv params
      but address can be set only after setting params.
      
      < HCI Command: LE Set Advertising Set Random Address (0x08|0x0035) plen 7
              Advertising handle: 0x00
              Advertising random address: 3C:8E:56:9B:77:84 (OUI 3C-8E-56)
      > HCI Event: Command Complete (0x0e) plen 4
            LE Set Advertising Set Random Address (0x08|0x0035) ncmd 1
              Status: Success (0x00)
      Signed-off-by: NJaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      a73c046a
    • J
      Bluetooth: Impmlement extended adv enable · de181e88
      Jaganath Kanakkassery 提交于
      This patch basically replaces legacy adv with extended adv
      based on the controller support. Currently there is no
      design change. ie only one adv set will be enabled at a time.
      
      This also adds tx_power in instance and store whatever returns
      from Set_ext_parameter, use the same in adv data as well.
      For instance 0 tx_power is stored in hdev only.
      
      < HCI Command: LE Set Extended Advertising Parameters (0x08|0x0036) plen 25
              Handle: 0x00
              Properties: 0x0010
                Use legacy advertising PDUs: ADV_NONCONN_IND
              Min advertising interval: 1280.000 msec (0x0800)
              Max advertising interval: 1280.000 msec (0x0800)
              Channel map: 37, 38, 39 (0x07)
              Own address type: Random (0x01)
              Peer address type: Public (0x00)
              Peer address: 00:00:00:00:00:00 (OUI 00-00-00)
              Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
              TX power: 127 dbm (0x7f)
              Primary PHY: LE 1M (0x01)
              Secondary max skip: 0x00
              Secondary PHY: LE 1M (0x01)
              SID: 0x00
              Scan request notifications: Disabled (0x00)
      > HCI Event: Command Complete (0x0e) plen 5
            LE Set Extended Advertising Parameters (0x08|0x0036) ncmd 1
              Status: Success (0x00)
              TX power (selected): 7 dbm (0x07)
      < HCI Command: LE Set Extended Advertising Enable (0x08|0x0039) plen 6
              Extended advertising: Enabled (0x01)
              Number of sets: 1 (0x01)
              Entry 0
                Handle: 0x00
                Duration: 0 ms (0x00)
                Max ext adv events: 0
      > HCI Event: Command Complete (0x0e) plen 4
            LE Set Extended Advertising Enable (0x08|0x0039) ncmd 2
              Status: Success (0x00)
      Signed-off-by: NJaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      de181e88
    • J
      Bluetooth: Read no of adv sets during init · 6b49bcb4
      Jaganath Kanakkassery 提交于
      This patch reads the number of advertising sets in the controller
      during init and save it in hdev.
      Signed-off-by: NJaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      6b49bcb4
    • J
      Bluetooth: Set Scan PHYs based on selected PHYs by user · 45bdd86e
      Jaganath Kanakkassery 提交于
      Use the PHYs selected in Set Phy Configuration management command
      while scanning.
      
      < HCI Command: LE Set Extended Scan Parameters (0x08|0x0041) plen 13
              Own address type: Random (0x01)
              Filter policy: Accept all advertisement (0x00)
              PHYs: 0x05
              Entry 0: LE 1M
                Type: Active (0x01)
                Interval: 11.250 msec (0x0012)
                Window: 11.250 msec (0x0012)
              Entry 1: LE Coded
                Type: Active (0x01)
                Interval: 11.250 msec (0x0012)
                Window: 11.250 msec (0x0012)
      > HCI Event: Command Complete (0x0e) plen 4
            LE Set Extended Scan Parameters (0x08|0x0041) ncmd 1
              Status: Success (0x00)
      < HCI Command: LE Set Extended Scan Enable (0x08|0x0042) plen 6
              Extended scan: Enabled (0x01)
              Filter duplicates: Enabled (0x01)
              Duration: 0 msec (0x0000)
              Period: 0.00 sec (0x0000)
      > HCI Event: Command Complete (0x0e) plen 4
            LE Set Extended Scan Enable (0x08|0x0042) ncmd 2
              Status: Success (0x00)
      Signed-off-by: NJaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      45bdd86e
    • J
      Bluetooth: Implement PHY changed event · b7c23df8
      Jaganath Kanakkassery 提交于
      This defines and implement phy changed event and send it to user
      whenever selected PHYs changes using SET_PHY_CONFIGURATION.
      
      This will be also trigerred when BREDR pkt_type is changed using
      the legacy ioctl HCISETPTYPE.
      
      @ MGMT Command: Set PHY Configuration (0x0045) plen 4
      		Selected PHYs: 0x7fff
      		  BR 1M 1SLOT
      		  BR 1M 3SLOT
      		  BR 1M 5SLOT
      		  EDR 2M 1SLOT
      		  EDR 2M 3SLOT
      		  EDR 2M 5SLOT
      		  EDR 3M 1SLOT
      		  EDR 3M 3SLOT
      		  EDR 3M 5SLOT
      		  LE 1M TX
      		  LE 1M RX
      		  LE 2M TX
      		  LE 2M RX
      		  LE CODED TX
      		  LE CODED RX
      < HCI Command: LE Set Default PHY (0x08|0x0031) plen 3
      		All PHYs preference: 0x00
      		TX PHYs preference: 0x07
      		  LE 1M
      		  LE 2M
      		  LE Coded
      		RX PHYs preference: 0x07
      		  LE 1M
      		  LE 2M
      		  LE Coded
      > HCI Event: Command Complete (0x0e) plen 4
      	  LE Set Default PHY (0x08|0x0031) ncmd 1
      		Status: Success (0x00)
      @ MGMT Event: Command Complete (0x0001) plen 3
      	  Set PHY Configuration (0x0045) plen 0
      		Status: Success (0x00)
      @ MGMT Event: PHY Configuration Changed (0x0026) plen 4
      		Selected PHYs: 0x7fff
      		  BR 1M 1SLOT
      		  BR 1M 3SLOT
      		  BR 1M 5SLOT
      		  EDR 2M 1SLOT
      		  EDR 2M 3SLOT
      		  EDR 2M 5SLOT
      		  EDR 3M 1SLOT
      		  EDR 3M 3SLOT
      		  EDR 3M 5SLOT
      		  LE 1M TX
      		  LE 1M RX
      		  LE 2M TX
      		  LE 2M RX
      		  LE CODED TX
      		  LE CODED RX
      Signed-off-by: NJaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      b7c23df8