* [PATCH v2] bluetooth: hci_qca: fix potential GPF
[not found] <YI+s2Hms/56Pvatu@hovoldconsulting.com>
@ 2021-05-03 10:06 ` Pavel Skripkin
2021-05-03 11:22 ` Johan Hovold
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Skripkin @ 2021-05-03 10:06 UTC (permalink / raw)
To: marcel, johan.hedberg
Cc: linux-bluetooth, linux-kernel, Pavel Skripkin, stable, Rocky Liao
In qca_power_shutdown() qcadev local variable is
initialized by hu->serdev.dev private data, but
hu->serdev can be NULL and there is a check for it.
Since, qcadev is not used before
if (!hu->serdev)
return;
we can move its initialization after this "if" to
prevent GPF.
Fixes: 5559904ccc08 ("Bluetooth: hci_qca: Add QCA Rome power off support to the qca_power_shutdown()")
Cc: stable@vger.kernel.org # v5.6+
Cc: Rocky Liao <rjliao@codeaurora.org>
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
drivers/bluetooth/hci_qca.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index de36af63e182..9589ef6c0c26 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1820,8 +1820,6 @@ static void qca_power_shutdown(struct hci_uart *hu)
unsigned long flags;
enum qca_btsoc_type soc_type = qca_soc_type(hu);
- qcadev = serdev_device_get_drvdata(hu->serdev);
-
/* From this point we go into power off state. But serial port is
* still open, stop queueing the IBS data and flush all the buffered
* data in skb's.
@@ -1837,6 +1835,8 @@ static void qca_power_shutdown(struct hci_uart *hu)
if (!hu->serdev)
return;
+ qcadev = serdev_device_get_drvdata(hu->serdev);
+
if (qca_is_wcn399x(soc_type)) {
host_set_baudrate(hu, 2400);
qca_send_power_pulse(hu, false);
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] bluetooth: hci_qca: fix potential GPF
2021-05-03 10:06 ` [PATCH v2] bluetooth: hci_qca: fix potential GPF Pavel Skripkin
@ 2021-05-03 11:22 ` Johan Hovold
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2021-05-03 11:22 UTC (permalink / raw)
To: Pavel Skripkin
Cc: marcel, johan.hedberg, linux-bluetooth, linux-kernel, stable,
Rocky Liao
On Mon, May 03, 2021 at 01:06:05PM +0300, Pavel Skripkin wrote:
> In qca_power_shutdown() qcadev local variable is
> initialized by hu->serdev.dev private data, but
> hu->serdev can be NULL and there is a check for it.
>
> Since, qcadev is not used before
>
> if (!hu->serdev)
> return;
>
> we can move its initialization after this "if" to
> prevent GPF.
>
> Fixes: 5559904ccc08 ("Bluetooth: hci_qca: Add QCA Rome power off support to the qca_power_shutdown()")
> Cc: stable@vger.kernel.org # v5.6+
> Cc: Rocky Liao <rjliao@codeaurora.org>
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> ---
Next time, put a changelog here so we know what changed since earlier
version(s).
Reviewed-by: Johan Hovold <johan@kernel.org>
> drivers/bluetooth/hci_qca.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index de36af63e182..9589ef6c0c26 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1820,8 +1820,6 @@ static void qca_power_shutdown(struct hci_uart *hu)
> unsigned long flags;
> enum qca_btsoc_type soc_type = qca_soc_type(hu);
>
> - qcadev = serdev_device_get_drvdata(hu->serdev);
> -
> /* From this point we go into power off state. But serial port is
> * still open, stop queueing the IBS data and flush all the buffered
> * data in skb's.
> @@ -1837,6 +1835,8 @@ static void qca_power_shutdown(struct hci_uart *hu)
> if (!hu->serdev)
> return;
>
> + qcadev = serdev_device_get_drvdata(hu->serdev);
> +
> if (qca_is_wcn399x(soc_type)) {
> host_set_baudrate(hu, 2400);
> qca_send_power_pulse(hu, false);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-03 11:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <YI+s2Hms/56Pvatu@hovoldconsulting.com>
2021-05-03 10:06 ` [PATCH v2] bluetooth: hci_qca: fix potential GPF Pavel Skripkin
2021-05-03 11:22 ` Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox