1. 05 11月, 2015 2 次提交
  2. 11 8月, 2015 1 次提交
    • J
      Bluetooth: Enable new connection establishment procedure. · fa142220
      Jakub Pawlowski 提交于
      Currently, when trying to connect to already paired device that just
      rotated its RPA MAC address, old address would be used and connection
      would fail. In order to fix that, kernel must scan and receive
      advertisement with fresh RPA before connecting.
      
      This patch enables new connection establishment procedure. Instead of just
      sending HCI_OP_LE_CREATE_CONN to controller, "connect" will add device to
      kernel whitelist and start scan. If advertisement is received, it'll be
      compared against whitelist and then trigger connection if it matches.
      That fixes mentioned reconnect issue for  already paired devices. It also
      make whole connection procedure more robust. We can try to connect to
      multiple devices at same time now, even though controller allow only one.
      Signed-off-by: NJakub Pawlowski <jpawlowski@google.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      fa142220
  3. 05 7月, 2015 1 次提交
    • L
      bluetooth: fix list handling · 9b284cbd
      Linus Torvalds 提交于
      Commit 835a6a2f ("Bluetooth: Stop sabotaging list poisoning")
      thought that the code was sabotaging the list poisoning when NULL'ing
      out the list pointers and removed it.
      
      But what was going on was that the bluetooth code was using NULL
      pointers for the list as a way to mark it empty, and that commit just
      broke it (and replaced the test with NULL with a "list_empty()" test on
      a uninitialized list instead, breaking things even further).
      
      So fix it all up to use the regular and real list_empty() handling
      (which does not use NULL, but a pointer to itself), also making sure to
      initialize the list properly (the previous NULL case was initialized
      implicitly by the session being allocated with kzalloc())
      
      This is a combination of patches by Marcel Holtmann and Tedd Ho-Jeong
      An.
      
      [ I would normally expect to get this through the bt tree, but I'm going
        to release -rc1, so I'm just committing this directly   - Linus ]
      Reported-and-tested-by: NJörg Otte <jrg.otte@gmail.com>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Original-by: NTedd Ho-Jeong An <tedd.an@intel.com>
      Original-by: Marcel Holtmann <marcel@holtmann.org>:
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9b284cbd
  4. 01 7月, 2015 1 次提交
    • T
      Bluetooth: Reinitialize the list after deletion for session user list · ab944c83
      Tedd Ho-Jeong An 提交于
      If the user->list is deleted with list_del(), it doesn't initialize the
      entry which can cause the issue with list_empty(). According to the
      comment from the list.h, list_empty() returns false even if the list is
      empty and put the entry in an undefined state.
      
      /**
       * list_del - deletes entry from list.
       * @entry: the element to delete from the list.
       * Note: list_empty() on entry does not return true after this, the entry is
       * in an undefined state.
       */
      
      Because of this behavior, list_empty() returns false even if list is empty
      when the device is reconnected.
      
      So, user->list needs to be re-initialized after list_del(). list.h already
      have a macro list_del_init() which deletes the entry and initailze it again.
      Signed-off-by: NTedd Ho-Jeong An <tedd.an@intel.com>
      Tested-by: NJörg Otte <jrg.otte@gmail.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      ab944c83
  5. 11 6月, 2015 1 次提交
  6. 09 6月, 2015 1 次提交
  7. 31 3月, 2015 1 次提交
  8. 14 3月, 2015 1 次提交
  9. 13 3月, 2015 1 次提交
  10. 19 2月, 2015 3 次提交
  11. 16 2月, 2015 1 次提交
    • J
      Bluetooth: Fix accepting early data on fixed channels · 315917e0
      Johan Hedberg 提交于
      On BR/EDR the L2CAP channel instances for fixed channels have so far
      been marked as ready only once the L2CAP information req/rsp procedure
      is complete and we have the fixed channel mask. This could however lead
      to data being dropped if we receive it on the channel before knowing the
      remote mask.
      
      Since it is valid for a remote to send data this early, simply assume
      that the channel is supported when we receive data on it. So far this
      hasn't been noticed much because of limited use of fixed channels on
      BR/EDR, but e.g. with SMP over BR/EDR this is already now visible with
      automated tests failing randomly.
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      315917e0
  12. 15 1月, 2015 3 次提交
  13. 03 1月, 2015 1 次提交
  14. 10 12月, 2014 2 次提交
  15. 06 12月, 2014 1 次提交
  16. 03 12月, 2014 1 次提交
  17. 02 12月, 2014 1 次提交
    • J
      Bluetooth: Track both local and remote L2CAP fixed channel mask · 0bd49fc7
      Johan Hedberg 提交于
      To pave the way for future fixed channels to be added easily we should
      track both the local and remote mask on a per-L2CAP connection (struct
      l2cap_conn) basis. So far the code has used a global variable in a racy
      way which anyway needs fixing.
      
      This patch renames the existing conn->fixed_chan_mask that tracked
      the remote mask to conn->remote_fixed_chan and adds a new variable
      conn->local_fixed_chan to track the local mask. Since the HS support
      info is now available in the local mask we can remove the
      conn->hs_enabled variable.
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      0bd49fc7
  18. 27 11月, 2014 1 次提交
  19. 15 11月, 2014 4 次提交
  20. 13 11月, 2014 1 次提交
  21. 29 10月, 2014 1 次提交
  22. 25 10月, 2014 2 次提交
  23. 02 10月, 2014 1 次提交
    • J
      Bluetooth: Fix lockdep warning with l2cap_chan_connect · 02e246ae
      Johan Hedberg 提交于
      The L2CAP connection's channel list lock (conn->chan_lock) must never be
      taken while already holding a channel lock (chan->lock) in order to
      avoid lock-inversion and lockdep warnings. So far the l2cap_chan_connect
      function has acquired the chan->lock early in the function and then
      later called l2cap_chan_add(conn, chan) which will try to take the
      conn->chan_lock. This violates the correct order of taking the locks and
      may lead to the following type of lockdep warnings:
      
      -> #1 (&conn->chan_lock){+.+...}:
             [<c109324d>] lock_acquire+0x9d/0x140
             [<c188459c>] mutex_lock_nested+0x6c/0x420
             [<d0aab48e>] l2cap_chan_add+0x1e/0x40 [bluetooth]
             [<d0aac618>] l2cap_chan_connect+0x348/0x8f0 [bluetooth]
             [<d0cc9a91>] lowpan_control_write+0x221/0x2d0 [bluetooth_6lowpan]
      -> #0 (&chan->lock){+.+.+.}:
             [<c10928d8>] __lock_acquire+0x1a18/0x1d20
             [<c109324d>] lock_acquire+0x9d/0x140
             [<c188459c>] mutex_lock_nested+0x6c/0x420
             [<d0ab05fd>] l2cap_connect_cfm+0x1dd/0x3f0 [bluetooth]
             [<d0a909c4>] hci_le_meta_evt+0x11a4/0x1260 [bluetooth]
             [<d0a910eb>] hci_event_packet+0x3ab/0x3120 [bluetooth]
             [<d0a7cb08>] hci_rx_work+0x208/0x4a0 [bluetooth]
      
             CPU0                    CPU1
             ----                    ----
        lock(&conn->chan_lock);
                                     lock(&chan->lock);
                                     lock(&conn->chan_lock);
        lock(&chan->lock);
      
      Before calling l2cap_chan_add() the channel is not part of the
      conn->chan_l list, and can therefore only be accessed by the L2CAP user
      (such as l2cap_sock.c). We can therefore assume that it is the
      responsibility of the user to handle mutual exclusion until this point
      (which we can see is already true in l2cap_sock.c by it in many places
      touching chan members without holding chan->lock).
      
      Since the hci_conn and by exctension l2cap_conn creation in the
      l2cap_chan_connect() function depend on chan details we cannot simply
      add a mutex_lock(&conn->chan_lock) in the beginning of the function
      (since the conn object doesn't yet exist there). What we can do however
      is move the chan->lock taking later into the function where we already
      have the conn object and can that way take conn->chan_lock first.
      
      This patch implements the above strategy and does some other necessary
      changes such as using __l2cap_chan_add() which assumes conn->chan_lock
      is held, as well as adding a second needed label so the unlocking
      happens as it should.
      Reported-by: NJukka Rissanen <jukka.rissanen@linux.intel.com>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      Tested-by: NJukka Rissanen <jukka.rissanen@linux.intel.com>
      Acked-by: NJukka Rissanen <jukka.rissanen@linux.intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      02e246ae
  24. 11 9月, 2014 1 次提交
    • J
      Bluetooth: Fix L2CAP information request handling for fixed channels · aeaeb4bb
      Johan Hedberg 提交于
      Even if we have no connection-oriented channels we should perform the
      L2CAP Information Request procedures before notifying L2CAP channels of
      the connection. This is so that the L2CAP channel implementations can
      perform checks on what the remote side supports (e.g. does it support
      the fixed channel in question).
      
      So far the code has relied on the l2cap_do_start() function to initiate
      the Information Request, however l2cap_do_start() is used on a
      per-channel basis and only for connection-oriented channels. This means
      that if there are no connection-oriented channels on the system we would
      never start the Information Request procedure.
      
      This patch creates a new l2cap_request_info() helper function to
      initiate the Information Request procedure, and ensures that it is
      called whenever a BR/EDR connection has been established. The patch also
      updates fixed channels to be notified of connection readiness only once
      the Information Request procedure has completed.
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      aeaeb4bb
  25. 09 9月, 2014 6 次提交