1. 01 2月, 2013 2 次提交
  2. 10 1月, 2013 4 次提交
    • G
      Bluetooth: Check if the hci connection exists in SCO shutdown · b7e98b51
      Gustavo Padovan 提交于
      Checking only for sco_conn seems to not be enough and lead to NULL
      dereferences in the code, check for hcon instead.
      
      <1>[11340.226404] BUG: unable to handle kernel NULL pointer dereference at
      0000000
      8
      <4>[11340.226619] EIP is at __sco_sock_close+0xe8/0x1a0
      <4>[11340.226629] EAX: f063a740 EBX: 00000000 ECX: f58f4544 EDX: 00000000
      <4>[11340.226640] ESI: dec83e00 EDI: 5f9a081f EBP: e0fdff38 ESP: e0fdff1c
      <0>[11340.226674] Stack:
      <4>[11340.226682]  c184db87 c1251028 dec83e00 e0fdff38 c1754aef dec83e00
      00000000
      e0fdff5c
      <4>[11340.226718]  c184f587 e0fdff64 e0fdff68 5f9a081f e0fdff5c c1751852
      d7813800
      62262f10
      <4>[11340.226752]  e0fdff70 c1753c00 00000000 00000001 0000000d e0fdffac
      c175425c
      00000041
      <0>[11340.226793] Call Trace:
      <4>[11340.226813]  [<c184db87>] ? sco_sock_clear_timer+0x27/0x60
      <4>[11340.226831]  [<c1251028>] ? local_bh_enable+0x68/0xd0
      <4>[11340.226846]  [<c1754aef>] ? lock_sock_nested+0x4f/0x60
      <4>[11340.226862]  [<c184f587>] sco_sock_shutdown+0x67/0xb0
      <4>[11340.226879]  [<c1751852>] ? sockfd_lookup_light+0x22/0x80
      <4>[11340.226897]  [<c1753c00>] sys_shutdown+0x30/0x60
      <4>[11340.226912]  [<c175425c>] sys_socketcall+0x1dc/0x2a0
      <4>[11340.226929]  [<c149ba78>] ? trace_hardirqs_on_thunk+0xc/0x10
      <4>[11340.226944]  [<c18860f1>] syscall_call+0x7/0xb
      <4>[11340.226960]  [<c1880000>] ? restore_cur+0x5e/0xd7
      <0>[11340.226969] Code: <f0> ff 4b 08 0f 94 c0 84 c0 74 20 80 7b 19 01 74
      2f b8 0a 00 00
      Reported-by: NChuansheng Liu <chuansheng.liu@intel.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      b7e98b51
    • J
      Bluetooth: Fix authentication if acl data comes before remote feature evt · 7b064eda
      Jaganath Kanakkassery 提交于
      If remote device sends l2cap info request before read_remote_ext_feature
      completes then mgmt_connected will be sent in hci_acldata_packet() and
      remote name request wont be sent and eventually authentication wont happen
      
      Hcidump log of the issue
      
      < HCI Command: Create Connection (0x01|0x0005) plen 13
          bdaddr BC:85:1F:74:7F:29 ptype 0xcc18 rswitch 0x01 clkoffset 0x4bf7 (valid)
          Packet type: DM1 DM3 DM5 DH1 DH3 DH5
      > HCI Event: Command Status (0x0f) plen 4
          Create Connection (0x01|0x0005) status 0x00 ncmd 1
      > HCI Event: Connect Complete (0x03) plen 11
          status 0x00 handle 12 bdaddr BC:85:1F:74:7F:29 type ACL encrypt 0x00
      < HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
          handle 12
      > HCI Event: Command Status (0x0f) plen 4
          Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
      > HCI Event: Read Remote Supported Features (0x0b) plen 11
          status 0x00 handle 12
          Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
      > HCI Event: Max Slots Change (0x1b) plen 3
          handle 12 slots 5
      < HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3
          handle 12 page 1
      > HCI Event: Command Status (0x0f) plen 4
          Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
      > ACL data: handle 12 flags 0x02 dlen 10
          L2CAP(s): Info req: type 2
      < ACL data: handle 12 flags 0x00 dlen 16
          L2CAP(s): Info rsp: type 2 result 0
            Extended feature mask 0x00b8
              Enhanced Retransmission mode
              Streaming mode
              FCS Option
              Fixed Channels
      > HCI Event: Read Remote Extended Features (0x23) plen 13
          status 0x00 handle 12 page 1 max 1
          Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
      > ACL data: handle 12 flags 0x02 dlen 10
          L2CAP(s): Info req: type 3
      < ACL data: handle 12 flags 0x00 dlen 20
          L2CAP(s): Info rsp: type 3 result 0
            Fixed channel list 0x00000002
              L2CAP Signalling Channel
      > HCI Event: Number of Completed Packets (0x13) plen 5
          handle 12 packets 2
      
      This patch moves sending mgmt_connected from hci_acldata_packet() to
      l2cap_connect_req() since this code is to handle the scenario remote
      device sends l2cap connect req too fast
      Signed-off-by: NJaganath Kanakkassery <jaganath.k@samsung.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      7b064eda
    • A
      Bluetooth: Fix incorrect strncpy() in hidp_setup_hid() · 0a9ab9bd
      Anderson Lizardo 提交于
      The length parameter should be sizeof(req->name) - 1 because there is no
      guarantee that string provided by userspace will contain the trailing
      '\0'.
      
      Can be easily reproduced by manually setting req->name to 128 non-zero
      bytes prior to ioctl(HIDPCONNADD) and checking the device name setup on
      input subsystem:
      
      $ cat /sys/devices/pnp0/00\:04/tty/ttyS0/hci0/hci0\:1/input8/name
      AAAAAA[...]AAAAAAAAf0:af:f0:af:f0:af
      
      ("f0:af:f0:af:f0:af" is the device bluetooth address, taken from "phys"
      field in struct hid_device due to overflow.)
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NAnderson Lizardo <anderson.lizardo@openbossa.org>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      0a9ab9bd
    • S
      Bluetooth: Fix sending HCI commands after reset · dbccd791
      Szymon Janc 提交于
      After sending reset command wait for its command complete event before
      sending next command. Some chips sends CC event for command received
      before reset if reset was send before chip replied with CC.
      
      This is also required by specification that host shall not send
      additional HCI commands before receiving CC for reset.
      
      < HCI Command: Reset (0x03|0x0003) plen 0                              [hci0] 18.404612
      > HCI Event: Command Complete (0x0e) plen 4                            [hci0] 18.405850
            Write Extended Inquiry Response (0x03|0x0052) ncmd 1
              Status: Success (0x00)
      < HCI Command: Read Local Supported Features (0x04|0x0003) plen 0      [hci0] 18.406079
      > HCI Event: Command Complete (0x0e) plen 4                            [hci0] 18.407864
            Reset (0x03|0x0003) ncmd 1
              Status: Success (0x00)
      < HCI Command: Read Local Supported Features (0x04|0x0003) plen 0      [hci0] 18.408062
      > HCI Event: Command Complete (0x0e) plen 12                           [hci0] 18.408835
      Signed-off-by: NSzymon Janc <szymon.janc@tieto.com>
      Cc: stable@vger.kernel.org
      Acked-by: NJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      dbccd791
  3. 07 12月, 2012 1 次提交
  4. 04 12月, 2012 12 次提交
    • G
      Revert "Bluetooth: Fix possible deadlock in SCO code" · 0b27a4b9
      Gustavo Padovan 提交于
      This reverts commit 269c4845.
      
      The commit was causing dead locks and NULL dereferences in the sco code:
      
       [28084.104013] BUG: soft lockup - CPU#0 stuck for 22s! [kworker/u:0H:7]
       [28084.104021] Modules linked in: btusb bluetooth <snip [last unloaded:
      bluetooth]
      ...
       [28084.104021]  [<c160246d>] _raw_spin_lock+0xd/0x10
       [28084.104021]  [<f920e708>] sco_conn_del+0x58/0x1b0 [bluetooth]
       [28084.104021]  [<f920f1a9>] sco_connect_cfm+0xb9/0x2b0 [bluetooth]
       [28084.104021]  [<f91ef289>]
      hci_sync_conn_complete_evt.isra.94+0x1c9/0x260 [bluetooth]
       [28084.104021]  [<f91f1a8d>] hci_event_packet+0x74d/0x2b40 [bluetooth]
       [28084.104021]  [<c1501abd>] ? __kfree_skb+0x3d/0x90
       [28084.104021]  [<c1501b46>] ? kfree_skb+0x36/0x90
       [28084.104021]  [<f91fcb4e>] ? hci_send_to_monitor+0x10e/0x190 [bluetooth]
       [28084.104021]  [<f91fcb4e>] ? hci_send_to_monitor+0x10e/0x190 [bluetooth]
      
      Cc: stable@vger.kernel.org
      Reported-by: NChan-yeol Park <chanyeol.park@gmail.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      0b27a4b9
    • A
      Bluetooth: trivial: Change NO_FCS_RECV to RECV_NO_FCS · f2592d3e
      Andrei Emeltchenko 提交于
      Make code more readable by changing CONF_NO_FCS_RECV which is read
      as "No L2CAP FCS option received" to CONF_RECV_NO_FCS which means
      "Received L2CAP option NO_FCS". This flag really means that we have
      received L2CAP FRAME CHECK SEQUENCE (FCS) OPTION with value "No FCS".
      Signed-off-by: NAndrei Emeltchenko <andrei.emeltchenko@intel.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      f2592d3e
    • A
      Bluetooth: Process receiving FCS_NONE in L2CAP Conf Rsp · cbabee78
      Andrei Emeltchenko 提交于
      Process L2CAP Config rsp Pending with FCS Option 0x00 (No FCS)
      which is sent by Motorola Windows 7 Bluetooth stack. The trace
      is shown below (all other options are skipped).
      
      ...
      < ACL data: handle 1 flags 0x00 dlen 48
          L2CAP(s): Config req: dcid 0x0043 flags 0x00 clen 36
            ...
            FCS Option 0x00 (No FCS)
      > ACL data: handle 1 flags 0x02 dlen 48
          L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 36
            ...
            FCS Option 0x01 (CRC16 Check)
      < ACL data: handle 1 flags 0x00 dlen 47
          L2CAP(s): Config rsp: scid 0x0043 flags 0x00 result 4 clen 33
            Pending
            ...
      > ACL data: handle 1 flags 0x02 dlen 50
          L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 4 clen 36
            Pending
            ...
            FCS Option 0x00 (No FCS)
      < ACL data: handle 1 flags 0x00 dlen 14
          L2CAP(s): Config rsp: scid 0x0043 flags 0x00 result 0 clen 0
            Success
      > ACL data: handle 1 flags 0x02 dlen 14
          L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 0
            Success
      ...
      Signed-off-by: NAndrei Emeltchenko <andrei.emeltchenko@intel.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      cbabee78
    • A
      Bluetooth: Fix missing L2CAP EWS Conf parameter · 60918918
      Andrei Emeltchenko 提交于
      If L2CAP_FEAT_FCS is not supported we sould miss EWS option
      configuration because of break. Make code more readable by
      combining FCS configuration in the single block.
      Signed-off-by: NAndrei Emeltchenko <andrei.emeltchenko@intel.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      60918918
    • A
      Bluetooth: AMP: Check that AMP is present and active · 5d05416e
      Andrei Emeltchenko 提交于
      Before starting quering remote AMP controllers make sure
      that there is local active AMP controller.
      Signed-off-by: NAndrei Emeltchenko <andrei.emeltchenko@intel.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      5d05416e
    • A
      Bluetooth: AMP: Mark controller radio powered down after HCIDEVDOWN · ced5c338
      Andrei Emeltchenko 提交于
      After getting HCIDEVDOWN controller did not mark itself as 0x00 which
      means: "The Controller radio is available but is currently physically
      powered down". The result was even if the hdev was down we return
      in controller list value 0x01 "status 0x01 (Bluetooth only)".
      Signed-off-by: NAndrei Emeltchenko <andrei.emeltchenko@intel.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      ced5c338
    • A
      Bluetooth: Refactor l2cap_send_disconn_req · 5e4e3972
      Andrei Emeltchenko 提交于
      l2cap_send_disconn_req takes 3 parameters of which conn might be
      derived from chan. Make this conversion inside l2cap_send_disconn_req.
      Signed-off-by: NAndrei Emeltchenko <andrei.emeltchenko@intel.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      5e4e3972
    • G
      Bluetooth: Move double negation to macros · ffa88e02
      Gustavo Padovan 提交于
      Some comparisons needs to double negation(!!) in order to make the value
      of the field boolean. Add it to the macro makes the code more readable.
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      ffa88e02
    • F
      Bluetooth: Implement deferred sco socket setup · 20714bfe
      Frédéric Dalleau 提交于
      In order to authenticate and configure an incoming SCO connection, the
      BT_DEFER_SETUP option was added. This option is intended to defer reply
      to Connect Request on SCO sockets.
      When a connection is requested, the listening socket is unblocked but
      the effective connection setup happens only on first recv. Any send
      between accept and recv fails with -ENOTCONN.
      Signed-off-by: NFrédéric Dalleau <frederic.dalleau@linux.intel.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      20714bfe
    • F
      Bluetooth: Add BT_DEFER_SETUP option to sco socket · b96e9c67
      Frédéric Dalleau 提交于
      This option will set the BT_SK_DEFER_SETUP bit in socket flags.
      Signed-off-by: NFrédéric Dalleau <frederic.dalleau@linux.intel.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      b96e9c67
    • G
      Bluetooth: cancel power_on work when unregistering the device · b9b5ef18
      Gustavo Padovan 提交于
      We need to cancel the hci_power_on work in order to avoid it run when we
      try to free the hdev.
      
      [ 1434.201149] ------------[ cut here ]------------
      [ 1434.204998] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0()
      [ 1434.208324] ODEBUG: free active (active state 0) object type: work_struct hint: hci
      _power_on+0x0/0x90
      [ 1434.210386] Pid: 8564, comm: trinity-child25 Tainted: G        W    3.7.0-rc5-next-
      20121112-sasha-00018-g2f4ce0e #127
      [ 1434.210760] Call Trace:
      [ 1434.210760]  [<ffffffff819f3d6e>] ? debug_print_object+0x8e/0xb0
      [ 1434.210760]  [<ffffffff8110b887>] warn_slowpath_common+0x87/0xb0
      [ 1434.210760]  [<ffffffff8110b911>] warn_slowpath_fmt+0x41/0x50
      [ 1434.210760]  [<ffffffff819f3d6e>] debug_print_object+0x8e/0xb0
      [ 1434.210760]  [<ffffffff8376b750>] ? hci_dev_open+0x310/0x310
      [ 1434.210760]  [<ffffffff83bf94e5>] ? _raw_spin_unlock_irqrestore+0x55/0xa0
      [ 1434.210760]  [<ffffffff819f3ee5>] __debug_check_no_obj_freed+0xa5/0x230
      [ 1434.210760]  [<ffffffff83785db0>] ? bt_host_release+0x10/0x20
      [ 1434.210760]  [<ffffffff819f4d15>] debug_check_no_obj_freed+0x15/0x20
      [ 1434.210760]  [<ffffffff8125eee7>] kfree+0x227/0x330
      [ 1434.210760]  [<ffffffff83785db0>] bt_host_release+0x10/0x20
      [ 1434.210760]  [<ffffffff81e539e5>] device_release+0x65/0xc0
      [ 1434.210760]  [<ffffffff819d3975>] kobject_cleanup+0x145/0x190
      [ 1434.210760]  [<ffffffff819d39cd>] kobject_release+0xd/0x10
      [ 1434.210760]  [<ffffffff819d33cc>] kobject_put+0x4c/0x60
      [ 1434.210760]  [<ffffffff81e548b2>] put_device+0x12/0x20
      [ 1434.210760]  [<ffffffff8376a334>] hci_free_dev+0x24/0x30
      [ 1434.210760]  [<ffffffff82fd8fe1>] vhci_release+0x31/0x60
      [ 1434.210760]  [<ffffffff8127be12>] __fput+0x122/0x250
      [ 1434.210760]  [<ffffffff811cab0d>] ? rcu_user_exit+0x9d/0xd0
      [ 1434.210760]  [<ffffffff8127bf49>] ____fput+0x9/0x10
      [ 1434.210760]  [<ffffffff81133402>] task_work_run+0xb2/0xf0
      [ 1434.210760]  [<ffffffff8106cfa7>] do_notify_resume+0x77/0xa0
      [ 1434.210760]  [<ffffffff83bfb0ea>] int_signal+0x12/0x17
      [ 1434.210760] ---[ end trace a6d57fefbc8a8cc7 ]---
      
      Cc: stable@vger.kernel.org
      Reported-by: NSasha Levin <sasha.levin@oracle.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      b9b5ef18
    • G
      Bluetooth: Add missing lock nesting notation · dc2a0e20
      Gustavo Padovan 提交于
      This patch fixes the following report, it happens when accepting rfcomm
      connections:
      
      [  228.165378] =============================================
      [  228.165378] [ INFO: possible recursive locking detected ]
      [  228.165378] 3.7.0-rc1-00536-gc1d5dc4a #120 Tainted: G        W
      [  228.165378] ---------------------------------------------
      [  228.165378] bluetoothd/1341 is trying to acquire lock:
      [  228.165378]  (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+...}, at:
      [<ffffffffa0000aa0>] bt_accept_dequeue+0xa0/0x180 [bluetooth]
      [  228.165378]
      [  228.165378] but task is already holding lock:
      [  228.165378]  (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+...}, at:
      [<ffffffffa0205118>] rfcomm_sock_accept+0x58/0x2d0 [rfcomm]
      [  228.165378]
      [  228.165378] other info that might help us debug this:
      [  228.165378]  Possible unsafe locking scenario:
      [  228.165378]
      [  228.165378]        CPU0
      [  228.165378]        ----
      [  228.165378]   lock(sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM);
      [  228.165378]   lock(sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM);
      [  228.165378]
      [  228.165378]  *** DEADLOCK ***
      [  228.165378]
      [  228.165378]  May be due to missing lock nesting notation
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      dc2a0e20
  5. 21 11月, 2012 5 次提交
  6. 20 11月, 2012 5 次提交
  7. 19 11月, 2012 3 次提交
  8. 09 11月, 2012 4 次提交
  9. 02 11月, 2012 4 次提交