1. 12 Dec, 2014 2 commits
    • Johan Hedberg's avatar
      Bluetooth: Fix mgmt response status when removing adapter · 9845904f
      Johan Hedberg authored
      When an adapter is removed (hci_unregister_dev) any pending mgmt
      commands for that adapter should get the appropriate INVALID_INDEX
      response. Since hci_unregister_dev() calls hci_dev_do_close() first
      that'd so far have caused "not powered" responses to be sent.
      
      Skipping the HCI_UNREGISTER case in mgmt_powered() is also not a
      solution since before reaching the mgmt_index_removed() stage any
      hci_conn callbacks (e.g. used by pairing) will get called, thereby
      causing "disconnected" status responses to be sent.
      
      The fix that covers all scenarios is to handle both INVALID_INDEX and
      NOT_POWERED responses through the mgmt_powered() function. The
      INVALID_INDEX response sending from mgmt_index_removed() is left
      untouched since there are a couple of places not related to powering off
      or removing an adapter that call it (e.g. configuring a new bdaddr).
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      9845904f
    • Johan Hedberg's avatar
      Bluetooth: Fix enabling BR/EDR SC when powering on · ec6f99b8
      Johan Hedberg authored
      If we're in the AUTO_OFF stage the powered_update_hci() function is
      responsible for doing the updates to the HCI state that were not done
      during the actual mgmt command handlers. One of the updates needing done
      is for BR/EDR SC support. This patch adds the missing HCI command for SC
      support to the powered_update_hci() function.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      ec6f99b8
  2. 11 Dec, 2014 6 commits
    • Johan Hedberg's avatar
      Bluetooth: Fix notifying mgmt power off before flushing connection list · 1aeb9c65
      Johan Hedberg authored
      This patch moves the mgmt_powered() notification earlier in the
      hci_dev_do_close() function. This way the correct "not powered" error
      gets passed to any pending mgmt commands. Without the patch the pending
      commands would instead get a misleading "disconnected" response when
      powering down the adapter.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      1aeb9c65
    • Johan Hedberg's avatar
      Bluetooth: Fix incorrect pending cmd removal in pairing_complete() · a511b35b
      Johan Hedberg authored
      The pairing_complete() function is used as a pending mgmt command
      cmd_complete callback. The expectation of such functions is that they
      are not responsible themselves for calling mgmt_pending_remove(). This
      patch fixes the incorrect mgmt_pending_remove() call in
      pairing_complete() and adds it to the appropriate changes.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      a511b35b
    • Johan Hedberg's avatar
      Bluetooth: Fix calling hci_conn_put too early · 15013aeb
      Johan Hedberg authored
      The pairing_complete() function relies on a hci_conn reference to be
      able to access the hci_conn object. It should therefore only release
      this reference once it's done accessing the object, i.e. at the end of
      the function.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      15013aeb
    • Marcel Holtmann's avatar
      Bluetooth: Fix check for support for page scan related commands · 417287de
      Marcel Holtmann authored
      The Read Page Scan Activity and Read Page Scan Type commands are not
      supported by all controllers. Move the execution of both commands
      into the 3rd phase of the init procedure. And then check the bit
      mask of supported commands before adding them to the init sequence.
      
      With this re-ordering of the init sequence, the extra check for
      AVM BlueFritz! controllers is no longer needed. They will report
      that these two commands are not supported.
      
      This fixes an issue with the Microsoft Corp. Wireless Transceiver
      for Bluetooth 2.0 (ID 045e:009c).
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      417287de
    • Jaganath Kanakkassery's avatar
      Bluetooth: Fix missing hci_dev_lock/unlock in hci_event · 5c1a4c8f
      Jaganath Kanakkassery authored
      mgmt_pending_remove() should be called with hci_dev_lock protection and
      all hci_event.c functions which calls mgmt_complete() (which eventually
      calls mgmt_pending_remove()) should hold the lock.
      So this patch fixes the same
      Signed-off-by: default avatarJaganath Kanakkassery <jaganath.k@samsung.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      5c1a4c8f
    • Jaganath Kanakkassery's avatar
      Bluetooth: Fix missing hci_dev_lock/unlock in mgmt req_complete() · 3ad67582
      Jaganath Kanakkassery authored
      mgmt_pending_remove() should be called with hci_dev_lock protection
      and currently the rule to take dev lock is that all mgmt req_complete
      functions should take dev lock. So this patch fixes the same in the
      missing functions
      
      Without this patch there is a chance of invalid memory access while
      accessing the mgmt_pending list like below
      
      bluetoothd:  392] [0] Backtrace:
      bluetoothd:  392] [0] [<c04ec770>] (pending_eir_or_class+0x0/0x68) from [<c04f1830>] (add_uuid+0x34/0x1c4)
      bluetoothd:  392] [0] [<c04f17fc>] (add_uuid+0x0/0x1c4) from [<c04f3cc4>] (mgmt_control+0x204/0x274)
      bluetoothd:  392] [0] [<c04f3ac0>] (mgmt_control+0x0/0x274) from [<c04f609c>] (hci_sock_sendmsg+0x80/0x308)
      bluetoothd:  392] [0] [<c04f601c>] (hci_sock_sendmsg+0x0/0x308) from [<c03d4d68>] (sock_aio_write+0x144/0x174)
      bluetoothd:  392] [0]  r8:00000000 r7 7c1be90 r6 7c1be18 r5:00000017 r4 a90ea80
      bluetoothd:  392] [0] [<c03d4c24>] (sock_aio_write+0x0/0x174) from [<c00e2d4c>] (do_sync_write+0xb0/0xe0)
      bluetoothd:  392] [0] [<c00e2c9c>] (do_sync_write+0x0/0xe0) from [<c00e371c>] (vfs_write+0x134/0x13c)
      bluetoothd:  392] [0]  r8:00000000 r7 7c1bf70 r6:beeca5c8 r5:00000017 r4 7c05900
      bluetoothd:  392] [0] [<c00e35e8>] (vfs_write+0x0/0x13c) from [<c00e3910>] (sys_write+0x44/0x70)
      bluetoothd:  392] [0]  r8:00000000 r7:00000004 r6:00000017 r5:beeca5c8 r4 7c05900
      bluetoothd:  392] [0] [<c00e38cc>] (sys_write+0x0/0x70) from [<c000e3c0>] (ret_fast_syscall+0x0/0x30)
      bluetoothd:  392] [0]  r9 7c1a000d r8:c000e568 r6:400b5f10 r5:403896d8 r4:beeca604
      bluetoothd:  392] [0] Code: e28cc00c e152000c 0a00000f e3a00001 (e1d210b8)
      bluetoothd:  392] [0] ---[ end trace 67b6ac67435864c4 ]---
      bluetoothd:  392] [0] Kernel panic - not syncing: Fatal exception
      Signed-off-by: default avatarJaganath Kanakkassery <jaganath.k@samsung.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      3ad67582
  3. 09 Dec, 2014 2 commits
    • Janne Heikkinen's avatar
      Bluetooth: Add USB device 04ca:3010 as Atheros AR3012 · 134d3b35
      Janne Heikkinen authored
      Asus X553MA has USB device 04ca:3010 that is Atheros AR3012
      or compatible.
      
      Device from /sys/kernel/debug/usb/devices:
      
      T:  Bus=01 Lev=02 Prnt=02 Port=03 Cnt=02 Dev#= 27 Spd=12   MxCh= 0
      D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=04ca ProdID=3010 Rev= 0.02
      C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
      A:  FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      Signed-off-by: default avatarJanne Heikkinen <janne.m.heikkinen@gmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      134d3b35
    • Fengguang Wu's avatar
      Bluetooth: fix err_cast.cocci warnings · fe700771
      Fengguang Wu authored
      net/bluetooth/smp.c:2650:9-16: WARNING: ERR_CAST can be used with tfm_aes
      
      Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))
      
      Generated by: scripts/coccinelle/api/err_cast.cocci
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      fe700771
  4. 08 Dec, 2014 1 commit
  5. 07 Dec, 2014 1 commit
  6. 06 Dec, 2014 1 commit
  7. 05 Dec, 2014 27 commits