summaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorMatthias Kaehlcke <mka@chromium.org>2019-04-23 14:16:52 -0400
committerMarcel Holtmann <marcel@holtmann.org>2019-04-23 15:38:06 -0400
commitecf2b768bd11e2ff09ecbe621b387d0d58e970cf (patch)
tree3d44e6e3d300580f04208d7dd4f7de8c2c327293 /drivers/bluetooth
parent5bec1fb866df8f58b04a46bcbe27481214977e4c (diff)
Bluetooth: hci_qca: Fix crash with non-serdev devices
qca_set_baudrate() calls serdev_device_wait_until_sent() assuming that the HCI is always associated with a serdev device. This isn't true for ROME controllers instantiated through ldisc, where the call causes a crash due to a NULL pointer dereferentiation. Only call the function when we have a serdev device. The timeout for ROME devices at the end of qca_set_baudrate() is long enough to be reasonably sure that the command was sent. Fixes: fa9ad876b8e0 ("Bluetooth: hci_qca: Add support for Qualcomm Bluetooth chip wcn3990") Reported-by: Balakrishna Godavarthi <bgodavar@codeaurora.org> Reported-by: Rocky Liao <rjliao@codeaurora.org> Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Rocky Liao <rjliao@codeaurora.org> Tested-by: Rocky Liao <rjliao@codeaurora.org> Reviewed-by: Balakrishna Godavarthi <bgodavar@codeaurora.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/hci_qca.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index a80c3bc90904..7f75652686fe 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1006,7 +1006,8 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
1006 while (!skb_queue_empty(&qca->txq)) 1006 while (!skb_queue_empty(&qca->txq))
1007 usleep_range(100, 200); 1007 usleep_range(100, 200);
1008 1008
1009 serdev_device_wait_until_sent(hu->serdev, 1009 if (hu->serdev)
1010 serdev_device_wait_until_sent(hu->serdev,
1010 msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS)); 1011 msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
1011 1012
1012 /* Give the controller time to process the request */ 1013 /* Give the controller time to process the request */