1. 04 Nov, 2019 3 commits
    • Tomas Bortoli's avatar
      Bluetooth: Fix invalid-free in bcsp_close() · cf94da6f
      Tomas Bortoli authored
      Syzbot reported an invalid-free that I introduced fixing a memleak.
      
      bcsp_recv() also frees bcsp->rx_skb but never nullifies its value.
      Nullify bcsp->rx_skb every time it is freed.
      Signed-off-by: default avatarTomas Bortoli <tomasbortoli@gmail.com>
      Reported-by: syzbot+a0d209a4676664613e76@syzkaller.appspotmail.com
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      cf94da6f
    • Claire Chang's avatar
      Bluetooth: hci_qca: add PM support · 41d5b25f
      Claire Chang authored
      Add PM suspend/resume callbacks for hci_qca driver.
      
      BT host will make sure both Rx and Tx go into sleep state in
      qca_suspend. Without this, Tx may still remain in awake state, which
      prevents BTSOC from entering deep sleep. For example, BlueZ will send
      Set Event Mask to device when suspending and this will wake the device
      Rx up. However, the Tx idle timeout on the host side is 2000 ms. If the
      host is suspended before its Tx idle times out, it won't send
      HCI_IBS_SLEEP_IND to the device and the device Rx will remain awake.
      
      We implement this by canceling relevant work in workqueue, sending
      HCI_IBS_SLEEP_IND to the device and then waiting HCI_IBS_SLEEP_IND sent
      by the device.
      
      In order to prevent the device from being awaken again after qca_suspend
      is called, we introduce QCA_SUSPEND flag. QCA_SUSPEND is set in the
      beginning of qca_suspend to indicate system is suspending and that we'd
      like to ignore any further wake events.
      
      With QCA_SUSPEND and spinlock, we can avoid race condition, e.g. if
      qca_enqueue acquires qca->hci_ibs_lock before qca_suspend calls
      cancel_work_sync and then qca_enqueue adds a new qca->ws_awake_device
      work after the previous one is cancelled.
      
      If BTSOC wants to wake the whole system up after qca_suspend is called,
      it will keep sending HCI_IBS_WAKE_IND and uart driver will take care of
      waking the system. For example, uart driver will reconfigure its Rx pin
      to a normal GPIO pin and enable irq wake on that pin when suspending.
      Once host detects Rx falling, the system will begin resuming. Then, the
      BT host clears QCA_SUSPEND flag in qca_resume and begins dealing with
      normal HCI packets. By doing so, only a few HCI_IBS_WAKE_IND packets are
      lost and there is no data packet loss.
      Signed-off-by: default avatarClaire Chang <tientzu@chromium.org>
      Reviewed-by: default avatarBalakrishna Godavarthi <bgodavar@codeaurora.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      41d5b25f
    • Luiz Augusto von Dentz's avatar
      Bluetooth: Fix advertising duplicated flags · 6012b934
      Luiz Augusto von Dentz authored
      Instances may have flags set as part of its data in which case the code
      should not attempt to add it again otherwise it can cause duplication:
      
      < HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 35
              Handle: 0x00
              Operation: Complete extended advertising data (0x03)
              Fragment preference: Minimize fragmentation (0x01)
              Data length: 0x06
              Flags: 0x04
                BR/EDR Not Supported
              Flags: 0x06
                LE General Discoverable Mode
                BR/EDR Not Supported
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      6012b934
  2. 26 Oct, 2019 21 commits
  3. 24 Oct, 2019 16 commits