1. 28 Mar, 2015 3 commits
    • Arman Uguray's avatar
      Bluetooth: Fix using global connectable settings for adv · faccb950
      Arman Uguray authored
      This patch fixes a bug where ADV_NONCONN_IND was being used for
      advertising instances >0 while the global connectable setting was
      set to "on".
      Signed-off-by: default avatarArman Uguray <armansito@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      faccb950
    • Johan Hedberg's avatar
      Bluetooth: Fix race condition with HCI_RESET flag · 600b2150
      Johan Hedberg authored
      During the HCI init phase a completed request might be the last part of
      the setup procedure after which the actual init procedure starts. The
      init procedure begins with a call to hci_reset_req() which sets the
      HCI_RESET flag. The purpose of this flag is to make us ignore any
      updates to ncmd/cmd_cnt as long as we haven't received the command
      complete event for the HCI_Reset. There's a potential race with this
      however:
      
      	hci_req_cmd_complete(hdev, opcode, status);
      
      	if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) {
      		atomic_set(&hdev->cmd_cnt, 1);
      		if (!skb_queue_empty(&hdev->cmd_q))
      			queue_work(hdev->workqueue, &hdev->cmd_work);
      	}
      
      Since the hci_req_cmd_complete() will trigger the completion of the
      setup stage, it's possible that hci_reset_req() gets called before we
      try to read ev->ncmd and the HCI_RESET flag. Because of this the cmd_cnt
      would never be updated and the hci_reset_req() in practice ends up
      blocking itself.
      
      This patch fixes the issue by updating cmd_cnt before notifying the
      request completion, and then reading it again to determine whether the
      cmd_work should be queued or not.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      600b2150
    • Marcel Holtmann's avatar
      Bluetooth: btusb: Consolidate Broadcom based device entries · 6331c686
      Marcel Holtmann authored
      For all modern Bluetooth USB devices from Broadcom it makes a lot more
      sense to use USB_VENDOR_AND_INTERFACE_INFO instead of manually adding
      USB_DEVICE for each one of them. There are already interface entries
      for these vendors and so just remove the duplicate device entries.
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      6331c686
  2. 27 Mar, 2015 3 commits
  3. 26 Mar, 2015 9 commits
  4. 25 Mar, 2015 2 commits
  5. 24 Mar, 2015 7 commits
  6. 23 Mar, 2015 1 commit
  7. 22 Mar, 2015 1 commit
  8. 21 Mar, 2015 1 commit
  9. 20 Mar, 2015 3 commits
  10. 19 Mar, 2015 1 commit
  11. 18 Mar, 2015 3 commits
  12. 17 Mar, 2015 6 commits
    • Johan Hedberg's avatar
      Bluetooth: Add workaround for broken OS X legacy SMP pairing · 19c5ce9c
      Johan Hedberg authored
      OS X version 10.10.2 (and possibly older versions) doesn't support LE
      Secure Connections but incorrectly copies all authentication request
      bits from a Security Request to its Pairing Request. The result is that
      an SC capable initiator (such as BlueZ) will think OS X intends to do SC
      when in fact it's incapable of it:
      
      < ACL Data TX: Handle 3585 flags 0x00 dlen 6
            SMP: Security Request (0x0b) len 1
              Authentication requirement: Bonding, No MITM, SC, No Keypresses (0x09)
      > ACL Data RX: Handle 3585 flags 0x02 dlen 11
            SMP: Pairing Request (0x01) len 6
              IO capability: KeyboardDisplay (0x04)
              OOB data: Authentication data not present (0x00)
              Authentication requirement: Bonding, No MITM, SC, No Keypresses (0x09)
              Max encryption key size: 16
              Initiator key distribution: EncKey (0x01)
              Responder key distribution: EncKey IdKey Sign (0x07)
      < ACL Data TX: Handle 3585 flags 0x00 dlen 11
            SMP: Pairing Response (0x02) len 6
              IO capability: NoInputNoOutput (0x03)
              OOB data: Authentication data not present (0x00)
              Authentication requirement: Bonding, No MITM, SC, No Keypresses (0x09)
              Max encryption key size: 16
              Initiator key distribution: EncKey (0x01)
              Responder key distribution: EncKey Sign (0x05)
      
      The pairing eventually fails when we get an unexpected Pairing Confirm
      PDU instead of a Public Key PDU:
      
      > ACL Data RX: Handle 3585 flags 0x02 dlen 21
            SMP: Pairing Confirm (0x03) len 16
              Confim value: bcc3bed31b8f313a78ec3cce32685faf
      
      It is only at this point that we can speculate that the remote doesn't
      really support SC. This patch creates a workaround for the just-works
      model, however the MITM case is unsolvable because the OS X user has
      already been requested to enter a PIN which we're now expected to
      randomly generate and show the user (i.e. a chicken-and-egg problem).
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      19c5ce9c
    • Johan Hedberg's avatar
      Bluetooth: Move generic mgmt command dispatcher to hci_sock.c · fa4335d7
      Johan Hedberg authored
      The mgmt.c file should be reserved purely for HCI_CHANNEL_CONTROL. The
      mgmt_control() function in it is already completely generic and has a
      single user in hci_sock.c. This patch moves the function there and
      renames it a bit more appropriately to hci_mgmt_cmd() (as it's a command
      dispatcher).
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      fa4335d7
    • Johan Hedberg's avatar
      Bluetooth: Add hdev_init callback for HCI channels · 88b94ce9
      Johan Hedberg authored
      In order to make the mgmt command handling more generic we can't have a
      direct call to mgmt_init_hdev() from mgmt_control(). This patch adds a
      new callback to struct hci_mgmt_chan. And sets it to point to the
      mgmt_init_hdev() function for the HCI_CHANNEL_CONTROL instance.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      88b94ce9
    • Johan Hedberg's avatar
      Bluetooth: Add generic mgmt helper API · a380b6cf
      Johan Hedberg authored
      There are several mgmt protocol features that will be needed by more
      than just the current HCI_CHANNEL_CONTROL. These include sending generic
      events as well as handling pending commands. This patch moves these
      functions out from mgmt.c to a new mgmt_util.c file.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      a380b6cf
    • Johan Hedberg's avatar
      Bluetooth: Add channel parameter to mgmt_pending_find() API · 333ae95d
      Johan Hedberg authored
      To be able to have pending commands for different HCI channels we need
      to be able to distinguish for which channel a command was sent to. The
      channel information is already part of the socket data and can be
      fetched using the recently added hci_sock_get_channel() function. To not
      require all mgmt.c code to pass an extra channel parameter this patch
      also adds a helper pending_find() & pending_find_data() functions which
      act as a wrapper to the new mgmt_pending_find() & mgmt_pending_find_data()
      APIs.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      333ae95d
    • Johan Hedberg's avatar
      Bluetooth: Add helper to get HCI channel of a socket · d0f172b1
      Johan Hedberg authored
      We'll need to have access to which HCI channel a socket is bound to, in
      order to manage pending mgmt commands in clean way. This patch adds a
      helper for the purpose.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      d0f172b1