* [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices
@ 2019-03-13 23:52 Matthias Kaehlcke
2019-03-22 4:53 ` rjliao
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Matthias Kaehlcke @ 2019-03-13 23:52 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg
Cc: linux-bluetooth, linux-kernel, Balakrishna Godavarthi, Hemantg,
Rocky Liao, Matthias Kaehlcke
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>
---
drivers/bluetooth/hci_qca.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 4ea995d610d2..714a6a16f9d5 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1004,7 +1004,8 @@ static int qca_set_baudrate(struct hci_dev
*hdev, uint8_t baudrate)
while (!skb_queue_empty(&qca->txq))
usleep_range(100, 200);
- serdev_device_wait_until_sent(hu->serdev,
+ if (hu->serdev)
+ serdev_device_wait_until_sent(hu->serdev,
msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
/* Give the controller time to process the request */
--
2.21.0.360.g471c308f928-goog
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices
2019-03-13 23:52 [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices Matthias Kaehlcke
@ 2019-03-22 4:53 ` rjliao
2019-04-01 7:42 ` Balakrishna Godavarthi
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: rjliao @ 2019-03-22 4:53 UTC (permalink / raw)
To: Matthias Kaehlcke
Cc: Marcel Holtmann, Johan Hedberg, linux-bluetooth, linux-kernel,
Balakrishna Godavarthi, Hemantg
在 2019-03-14 07:52,Matthias Kaehlcke 写道:
> 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>
> ---
> drivers/bluetooth/hci_qca.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 4ea995d610d2..714a6a16f9d5 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1004,7 +1004,8 @@ static int qca_set_baudrate(struct hci_dev
> *hdev, uint8_t baudrate)
> while (!skb_queue_empty(&qca->txq))
> usleep_range(100, 200);
>
> - serdev_device_wait_until_sent(hu->serdev,
> + if (hu->serdev)
> + serdev_device_wait_until_sent(hu->serdev,
> msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
>
> /* Give the controller time to process the request */
Reviewed-by: Rocky Liao <rjliao@codeaurora.org>
Tested-by: Rocky Liao <rjliao@codeaurora.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices
2019-03-13 23:52 [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices Matthias Kaehlcke
2019-03-22 4:53 ` rjliao
@ 2019-04-01 7:42 ` Balakrishna Godavarthi
2019-04-01 21:35 ` Matthias Kaehlcke
2019-04-23 17:26 ` Marcel Holtmann
3 siblings, 0 replies; 8+ messages in thread
From: Balakrishna Godavarthi @ 2019-04-01 7:42 UTC (permalink / raw)
To: Matthias Kaehlcke
Cc: Marcel Holtmann, Johan Hedberg, linux-bluetooth, linux-kernel,
Hemantg, Rocky Liao
On 2019-03-14 05:22, Matthias Kaehlcke wrote:
> 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>
> ---
> drivers/bluetooth/hci_qca.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 4ea995d610d2..714a6a16f9d5 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1004,7 +1004,8 @@ static int qca_set_baudrate(struct hci_dev
> *hdev, uint8_t baudrate)
> while (!skb_queue_empty(&qca->txq))
> usleep_range(100, 200);
>
> - serdev_device_wait_until_sent(hu->serdev,
> + if (hu->serdev)
> + serdev_device_wait_until_sent(hu->serdev,
> msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
>
> /* Give the controller time to process the request */
Reviewed-by: Balakrishna Godavarthi <bgodavar@codeaurora.org>
--
Regards
Balakrishna.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices
2019-03-13 23:52 [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices Matthias Kaehlcke
2019-03-22 4:53 ` rjliao
2019-04-01 7:42 ` Balakrishna Godavarthi
@ 2019-04-01 21:35 ` Matthias Kaehlcke
2019-04-23 17:26 ` Marcel Holtmann
3 siblings, 0 replies; 8+ messages in thread
From: Matthias Kaehlcke @ 2019-04-01 21:35 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg
Cc: linux-bluetooth, linux-kernel, Balakrishna Godavarthi, Hemantg,
Rocky Liao
Hi Marcel,
do you have any comments or can this fix be landed?
Thanks
Matthias
On Wed, Mar 13, 2019 at 04:52:19PM -0700, Matthias Kaehlcke wrote:
> 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>
> ---
> drivers/bluetooth/hci_qca.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 4ea995d610d2..714a6a16f9d5 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1004,7 +1004,8 @@ static int qca_set_baudrate(struct hci_dev
> *hdev, uint8_t baudrate)
> while (!skb_queue_empty(&qca->txq))
> usleep_range(100, 200);
>
> - serdev_device_wait_until_sent(hu->serdev,
> + if (hu->serdev)
> + serdev_device_wait_until_sent(hu->serdev,
> msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
>
> /* Give the controller time to process the request */
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices
2019-03-13 23:52 [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices Matthias Kaehlcke
` (2 preceding siblings ...)
2019-04-01 21:35 ` Matthias Kaehlcke
@ 2019-04-23 17:26 ` Marcel Holtmann
2019-04-23 17:57 ` Matthias Kaehlcke
3 siblings, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2019-04-23 17:26 UTC (permalink / raw)
To: Matthias Kaehlcke
Cc: Johan Hedberg, linux-bluetooth, linux-kernel,
Balakrishna Godavarthi, Hemantg, Rocky Liao
Hi Matthias,
> 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>
> ---
> drivers/bluetooth/hci_qca.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 4ea995d610d2..714a6a16f9d5 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1004,7 +1004,8 @@ static int qca_set_baudrate(struct hci_dev
> *hdev, uint8_t baudrate)
> while (!skb_queue_empty(&qca->txq))
> usleep_range(100, 200);
>
> - serdev_device_wait_until_sent(hu->serdev,
> + if (hu->serdev)
> + serdev_device_wait_until_sent(hu->serdev,
> msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
somehow I get a malformed patch when I try to apply it. Can you send a new version against bluetooth-next with all tags added.
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices
2019-04-23 17:26 ` Marcel Holtmann
@ 2019-04-23 17:57 ` Matthias Kaehlcke
0 siblings, 0 replies; 8+ messages in thread
From: Matthias Kaehlcke @ 2019-04-23 17:57 UTC (permalink / raw)
To: Marcel Holtmann
Cc: Johan Hedberg, linux-bluetooth, linux-kernel,
Balakrishna Godavarthi, Hemantg, Rocky Liao
On Tue, Apr 23, 2019 at 07:26:40PM +0200, Marcel Holtmann wrote:
> Hi Matthias,
>
> > 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>
> > ---
> > drivers/bluetooth/hci_qca.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> > index 4ea995d610d2..714a6a16f9d5 100644
> > --- a/drivers/bluetooth/hci_qca.c
> > +++ b/drivers/bluetooth/hci_qca.c
> > @@ -1004,7 +1004,8 @@ static int qca_set_baudrate(struct hci_dev
> > *hdev, uint8_t baudrate)
> > while (!skb_queue_empty(&qca->txq))
> > usleep_range(100, 200);
> >
> > - serdev_device_wait_until_sent(hu->serdev,
> > + if (hu->serdev)
> > + serdev_device_wait_until_sent(hu->serdev,
> > msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
>
> somehow I get a malformed patch when I try to apply it. Can you send a new version against bluetooth-next with all tags added.
Dunno what happened there, I'll send a new version with the tags in a
bit.
Thanks
Matthias
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices
2019-04-23 18:16 Matthias Kaehlcke
@ 2019-04-23 19:38 ` Marcel Holtmann
0 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2019-04-23 19:38 UTC (permalink / raw)
To: Matthias Kaehlcke
Cc: Johan Hedberg, linux-bluetooth, linux-kernel,
Balakrishna Godavarthi, Hemantg, Rocky Liao
Hi Matthias,
> 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>
> ---
> Changes in v2:
> - first version got corrupted for some reason, this should apply
> - added 'Reviewed-by' tags from Rocky abd Balakrishna
> - added 'Tested-by' tag from Rocky
> ---
> drivers/bluetooth/hci_qca.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices
@ 2019-04-23 18:16 Matthias Kaehlcke
2019-04-23 19:38 ` Marcel Holtmann
0 siblings, 1 reply; 8+ messages in thread
From: Matthias Kaehlcke @ 2019-04-23 18:16 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg
Cc: linux-bluetooth, linux-kernel, Balakrishna Godavarthi, Hemantg,
Rocky Liao, Matthias Kaehlcke
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>
---
Changes in v2:
- first version got corrupted for some reason, this should apply
- added 'Reviewed-by' tags from Rocky abd Balakrishna
- added 'Tested-by' tag from Rocky
---
drivers/bluetooth/hci_qca.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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)
while (!skb_queue_empty(&qca->txq))
usleep_range(100, 200);
- serdev_device_wait_until_sent(hu->serdev,
+ if (hu->serdev)
+ serdev_device_wait_until_sent(hu->serdev,
msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
/* Give the controller time to process the request */
--
2.21.0.593.g511ec345e18-goog
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-04-23 19:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13 23:52 [PATCH] Bluetooth: hci_qca: Fix crash with non-serdev devices Matthias Kaehlcke
2019-03-22 4:53 ` rjliao
2019-04-01 7:42 ` Balakrishna Godavarthi
2019-04-01 21:35 ` Matthias Kaehlcke
2019-04-23 17:26 ` Marcel Holtmann
2019-04-23 17:57 ` Matthias Kaehlcke
2019-04-23 18:16 Matthias Kaehlcke
2019-04-23 19:38 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).