1. 30 4月, 2017 3 次提交
    • D
      Bluetooth: hci_ldisc: Add protocol check to hci_uart_tx_wakeup() · 2d6f1da1
      Dean Jenkins 提交于
      Before attempting to schedule a work-item onto hu->write_work in
      hci_uart_tx_wakeup(), check that the Data Link protocol layer is
      still bound to the HCI UART driver.
      
      Failure to perform this protocol check causes a race condition between
      the work queue hu->write_work running hci_uart_write_work() and the
      Data Link protocol layer being unbound (closed) in hci_uart_tty_close().
      
      Note hci_uart_tty_close() does have a "cancel_work_sync(&hu->write_work)"
      but it is ineffective because it cannot prevent work-items being added
      to hu->write_work after cancel_work_sync() has run.
      
      Therefore, add a check for HCI_UART_PROTO_READY into hci_uart_tx_wakeup()
      which prevents scheduling of the work queue when HCI_UART_PROTO_READY
      is in the clear state. However, note a small race condition remains
      because the hci_uart_tx_wakeup() thread can run in parallel with the
      hci_uart_tty_close() thread so it is possible that a schedule of
      hu->write_work can occur when HCI_UART_PROTO_READY is cleared. A complete
      solution needs locking of the threads which is implemented in a future
      commit.
      Signed-off-by: NDean Jenkins <Dean_Jenkins@mentor.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      2d6f1da1
    • D
      Bluetooth: hci_ldisc: Add protocol check to hci_uart_dequeue() · 048e1bd3
      Dean Jenkins 提交于
      Before attempting to dequeue a Data Link protocol encapsulated message,
      check that the Data Link protocol is still bound to the HCI UART driver.
      This makes the code consistent with the usage of the other proto
      function pointers.
      
      Therefore, add a check for HCI_UART_PROTO_READY into hci_uart_dequeue()
      and return NULL if the Data Link protocol is not bound.
      
      This is needed for robustness as there is a scheduling race condition.
      hci_uart_write_work() is scheduled to run via work queue hu->write_work
      from hci_uart_tx_wakeup(). Therefore, there is a delay between
      scheduling hci_uart_write_work() to run and hci_uart_dequeue() running
      whereby the Data Link protocol layer could become unbound during the
      scheduling delay. In this case, without the check, the call to the
      unbound Data Link protocol layer dequeue function can crash.
      
      It is noted that hci_uart_tty_close() has a
      "cancel_work_sync(&hu->write_work)" statement but this only reduces
      the window of the race condition because it is possible for a new
      work-item to be added to work queue hu->write_work after the call to
      cancel_work_sync(). For example, Data Link layer retransmissions can
      be added to the work queue after the cancel_work_sync() has finished.
      Signed-off-by: NDean Jenkins <Dean_Jenkins@mentor.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      048e1bd3
    • D
      Bluetooth: hci_ldisc: Add protocol check to hci_uart_send_frame() · ab00f89f
      Dean Jenkins 提交于
      Before attempting to send a HCI message, check that the Data Link
      protocol is still bound to the HCI UART driver. This makes the code
      consistent with the usage of the other proto function pointers.
      
      Therefore, add a check for HCI_UART_PROTO_READY into hci_uart_send_frame()
      and return -EUNATCH if the Data Link protocol is not bound.
      
      This also allows hci_send_frame() to report the error of an unbound
      Data Link protocol layer. Therefore, it assists with diagnostics into
      why HCI messages are being sent when the Data Link protocol is not
      bound and avoids potential crashes.
      Signed-off-by: NDean Jenkins <Dean_Jenkins@mentor.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      ab00f89f
  2. 22 4月, 2017 3 次提交
  3. 14 4月, 2017 1 次提交
  4. 13 4月, 2017 2 次提交
  5. 24 9月, 2016 1 次提交
  6. 20 9月, 2016 1 次提交
  7. 10 7月, 2016 1 次提交
    • M
      Bluetooth: Rename HCI_BREDR into HCI_PRIMARY · ca8bee5d
      Marcel Holtmann 提交于
      The HCI_BREDR naming is confusing since it actually stands for Primary
      Bluetooth Controller. Which is a term that has been used in the latest
      standard. However from a legacy point of view there only really have
      been Basic Rate (BR) and Enhanced Data Rate (EDR). Recent versions of
      Bluetooth introduced Low Energy (LE) and made this terminology a little
      bit confused since Dual Mode Controllers include BR/EDR and LE. To
      simplify this the name HCI_PRIMARY stands for the Primary Controller
      which can be a single mode or dual mode controller.
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      ca8bee5d
  8. 09 4月, 2016 1 次提交
  9. 24 2月, 2016 1 次提交
  10. 10 12月, 2015 1 次提交
  11. 20 11月, 2015 1 次提交
  12. 21 10月, 2015 1 次提交
  13. 05 10月, 2015 2 次提交
  14. 24 9月, 2015 1 次提交
    • F
      Bluetooth: Remove useless rx_lock spinlock · 7649faff
      Frederic Danis 提交于
      rx_lock spinlock is only used in hci_uart_tty_receive() which is the
      receive_buf ldisc callback.
      
      hci_uart_tty_receive() is protected from re-entrance by its only
      caller (flush_to_ldisc() in drivers/tty/tty_buffer.c) which held a
      mutex (buf->lock) for this section.
      This lock allows "safe use of the line discipline's receive_buf()
      method by excluding the buffer work and any pending flush from using
      the flip buffer." (comments from tty_buffer_lock_exclusive() in
      drivers/tty/tty_buffer.c)
      
      So, no need to double protect this resource with rx_lock.
      Signed-off-by: NFrederic Danis <frederic.danis@linux.intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      7649faff
  15. 11 8月, 2015 1 次提交
  16. 27 7月, 2015 1 次提交
  17. 23 7月, 2015 1 次提交
  18. 18 6月, 2015 2 次提交
  19. 06 6月, 2015 2 次提交
  20. 08 4月, 2015 12 次提交
  21. 02 4月, 2015 1 次提交