Commit 0d4ca252 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Greg Kroah-Hartman

Bluetooth: hci_qca: Fix crash with non-serdev devices

[ Upstream commit ecf2b768 ]

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: fa9ad876 ("Bluetooth: hci_qca: Add support for Qualcomm Bluetooth chip wcn3990")
Reported-by: default avatarBalakrishna Godavarthi <bgodavar@codeaurora.org>
Reported-by: default avatarRocky Liao <rjliao@codeaurora.org>
Signed-off-by: default avatarMatthias Kaehlcke <mka@chromium.org>
Reviewed-by: default avatarRocky Liao <rjliao@codeaurora.org>
Tested-by: default avatarRocky Liao <rjliao@codeaurora.org>
Reviewed-by: default avatarBalakrishna Godavarthi <bgodavar@codeaurora.org>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 095eaec4
...@@ -992,6 +992,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) ...@@ -992,6 +992,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
while (!skb_queue_empty(&qca->txq)) while (!skb_queue_empty(&qca->txq))
usleep_range(100, 200); usleep_range(100, 200);
if (hu->serdev)
serdev_device_wait_until_sent(hu->serdev, serdev_device_wait_until_sent(hu->serdev,
msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS)); msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment