1. 29 3月, 2015 3 次提交
    • A
      Bluetooth: Use ADV_SCAN_IND for adv. instances · c7d4883b
      Arman Uguray 提交于
      With this patch, ADV_SCAN_IND will be used for advertising instances
      that have non-zero scan response data while the global "connectable"
      setting is "off".
      Signed-off-by: NArman Uguray <armansito@chromium.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      c7d4883b
    • A
      Bluetooth: Fix using global connectable settings for adv · faccb950
      Arman Uguray 提交于
      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: NArman Uguray <armansito@chromium.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      faccb950
    • J
      Bluetooth: Fix race condition with HCI_RESET flag · 600b2150
      Johan Hedberg 提交于
      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: NJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      600b2150
  2. 28 3月, 2015 4 次提交
  3. 26 3月, 2015 10 次提交
  4. 25 3月, 2015 1 次提交
  5. 24 3月, 2015 7 次提交
  6. 23 3月, 2015 1 次提交
  7. 22 3月, 2015 1 次提交
  8. 21 3月, 2015 2 次提交
  9. 20 3月, 2015 2 次提交
  10. 19 3月, 2015 3 次提交
  11. 18 3月, 2015 6 次提交
    • M
      Bluetooth: Fix potential NULL dereference in SMP channel setup · 63511f6d
      Marcel Holtmann 提交于
      When the allocation of the L2CAP channel for the BR/EDR security manager
      fails, then the smp variable might be NULL. In that case do not try to
      free the non-existing crypto contexts
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      63511f6d
    • J
      Bluetooth: Add workaround for broken OS X legacy SMP pairing · 19c5ce9c
      Johan Hedberg 提交于
      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: NJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      19c5ce9c
    • J
      Bluetooth: Move generic mgmt command dispatcher to hci_sock.c · fa4335d7
      Johan Hedberg 提交于
      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: NJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      fa4335d7
    • J
      Bluetooth: Add hdev_init callback for HCI channels · 88b94ce9
      Johan Hedberg 提交于
      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: NJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      88b94ce9
    • J
      Bluetooth: Add generic mgmt helper API · a380b6cf
      Johan Hedberg 提交于
      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: NJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      a380b6cf
    • J
      Bluetooth: Add channel parameter to mgmt_pending_find() API · 333ae95d
      Johan Hedberg 提交于
      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: NJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      333ae95d