1. 27 2月, 2014 1 次提交
  2. 24 2月, 2014 3 次提交
  3. 19 2月, 2014 3 次提交
  4. 13 2月, 2014 7 次提交
  5. 19 10月, 2013 2 次提交
  6. 17 10月, 2013 2 次提交
  7. 13 10月, 2013 3 次提交
  8. 12 10月, 2013 1 次提交
  9. 11 10月, 2013 2 次提交
  10. 10 10月, 2013 2 次提交
  11. 06 10月, 2013 1 次提交
  12. 05 10月, 2013 1 次提交
  13. 04 10月, 2013 2 次提交
  14. 02 10月, 2013 1 次提交
    • J
      Bluetooth: Introduce a new HCI_BREDR_ENABLED flag · 56f87901
      Johan Hedberg 提交于
      To allow treating dual-mode (BR/EDR/LE) controllers as single-mode ones
      (LE-only) we want to introduce a new HCI_BREDR_ENABLED flag to track
      whether BR/EDR is enabled or not (previously we simply looked at the
      feature bit with lmp_bredr_enabled).
      
      This patch add the new flag and updates the relevant places to test
      against it instead of using lmp_bredr_enabled. The flag is by default
      enabled when registering an adapter and only cleared if necessary once
      the local features have been read during the HCI init procedure.
      
      We cannot completely block BR/EDR usage in case user space uses raw HCI
      sockets but the patch tries to block this in places where possible, such
      as the various BR/EDR specific ioctls.
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      56f87901
  15. 17 9月, 2013 1 次提交
  16. 21 8月, 2013 3 次提交
  17. 17 4月, 2013 2 次提交
    • D
      Bluetooth: introduce hci_conn ref-counting · 8d12356f
      David Herrmann 提交于
      We currently do not allow using hci_conn from outside of HCI-core.
      However, several other users could make great use of it. This includes
      HIDP, rfcomm and all other sub-protocols that rely on an active
      connection.
      
      Hence, we now introduce hci_conn ref-counting. We currently never call
      get_device(). put_device() is exclusively used in hci_conn_del_sysfs().
      Hence, we currently never have a greater device-refcnt than 1.
      Therefore, it is safe to move the put_device() call from
      hci_conn_del_sysfs() to hci_conn_del() (it's the only caller). In fact,
      this even fixes a "use-after-free" bug as we access hci_conn after calling
      hci_conn_del_sysfs() in hci_conn_del().
      
      From now on we can add references to hci_conn objects in other layers
      (like l2cap_sock, HIDP, rfcomm, ...) and grab a reference via
      hci_conn_get(). This does _not_ guarantee, that the connection is still
      alive. But, this isn't what we want. We can simply lock the hci_conn
      device and use "device_is_registered(hci_conn->dev)" to test that.
      However, this is hardly necessary as outside users should never rely on
      the HCI connection to be alive, anyway. Instead, they should solely rely
      on the device-object to be available.
      But if sub-devices want the hci_conn object as sysfs parent, they need to
      be notified when the connection drops. This will be introduced in later
      patches with l2cap_users.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      8d12356f
    • D
      Bluetooth: remove unneeded hci_conn_hold/put_device() · fc225c3f
      David Herrmann 提交于
      hci_conn_hold/put_device() is used to control when hci_conn->dev is no
      longer needed and can be deleted from the system. Lets first look how they
      are currently used throughout the code (excluding HIDP!).
      
      All code that uses hci_conn_hold_device() looks like this:
          ...
          hci_conn_hold_device();
          hci_conn_add_sysfs();
          ...
      On the other side, hci_conn_put_device() is exclusively used in
      hci_conn_del().
      
      So, considering that hci_conn_del() must not be called twice (which would
      fail horribly), we know that hci_conn_put_device() is only called _once_
      (which is in hci_conn_del()).
      On the other hand, hci_conn_add_sysfs() must not be called twice, either
      (it would call device_add twice, which breaks the device, see
      drivers/base/core.c). So we know that hci_conn_hold_device() is also
      called only once (it's only called directly before hci_conn_add_sysfs()).
      
      So hold and put are known to be called only once. That means we can safely
      remove them and directly call hci_conn_del_sysfs() in hci_conn_del().
      
      But there is one issue left: HIDP also uses hci_conn_hold/put_device().
      However, this case can be ignored and simply removed as it is totally
      broken. The issue is, the only thing HIDP delays with
      hci_conn_hold_device() is the removal of the hci_conn->dev from sysfs.
      But, the hci_conn device has no mechanism to get notified when its own
      parent (hci_dev) gets removed from sysfs. hci_dev_hold/put() does _not_
      control when it is removed but only when the device object is created
      and destroyed.
      And hci_dev calls hci_conn_flush_*() when it removes itself from sysfs,
      which itself causes hci_conn_del() to be called, but it does _not_ cause
      hci_conn_del_sysfs() to be called, which is wrong.
      
      Hence, we fix it to call hci_conn_del_sysfs() in hci_conn_del(). This
      guarantees that a hci_conn object is removed from sysfs _before_ its
      parent hci_dev is removed.
      
      The changes to HIDP look scary, wrong and broken. However, if you look at
      the HIDP session management, you will notice they're already broken in the
      exact _same_ way (ever tried "unplugging" HIDP devices? Breaks _all_ the
      time).
      So this patch only makes HIDP look _scary_ and _obviously broken_. It does
      not break HIDP itself, it already is!
      
      See later patches in this series which fix HIDP to use proper
      session-management.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      fc225c3f
  18. 12 4月, 2013 2 次提交
    • C
      Bluetooth: Reject SCO when hci connection timeouts · 93796fa6
      Claudio Takahasi 提交于
      This patch sends Reject Synchronous Connection Request Command when
      hci_conn_timeout is triggered, and the SCO connection is in BT_CONNECT2
      state. It prevents inconsistency if the remote host doesn't implement
      properly the timeout for the connection request, and it removes the
      connection reference left when the socket is closed for incoming SCO
      connections.
      
      [ 2650.129080] sco_sock_release: sock ffff8801ca417400, sk ffff88020c408800
      [ 2650.129092] sco_sock_clear_timer: sock ffff88020c408800 state 6
      [ 2650.129101] __sco_sock_close: sk ffff88020c408800 state 6 socket
      	ffff8801ca417400
      [ 2650.129108] sco_chan_del: sk ffff88020c408800, conn ffff8801c650ea20,
      	err 104
      [ 2650.129114] hci_conn_put: hcon ffff88020c40a800 orig refcnt 1
      [ 2650.129128] sco_sock_kill: sk ffff88020c408800 state 9
      [ 2650.129135] sco_sock_destruct: sk ffff88020c408800
      [ 2650.138468] hci_conn_timeout: hcon ffff88020c40a800 state BT_CONNECT2
      Signed-off-by: NClaudio Takahasi <claudio.takahasi@openbossa.org>
      Signed-off-by: NVinicius Costa Gomes <vinicius.gomes@openbossa.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      93796fa6
    • D
      Bluetooth: rename hci_conn_put to hci_conn_drop · 76a68ba0
      David Herrmann 提交于
      We use _get() and _put() for device ref-counting in the kernel. However,
      hci_conn_put() is _not_ used for ref-counting, hence, rename it to
      hci_conn_drop() so we can later fix ref-counting and introduce
      hci_conn_put().
      
      hci_conn_hold() and hci_conn_put() are currently used to manage how long a
      connection should be held alive. When the last user drops the connection,
      we spawn a delayed work that performs the disconnect. Obviously, this has
      nothing to do with ref-counting for the _object_ but rather for the
      keep-alive of the connection.
      
      But we really _need_ proper ref-counting for the _object_ to allow
      connection-users like rfcomm-tty, HIDP or others.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      76a68ba0
  19. 08 3月, 2013 1 次提交