[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210712060925.004978662@linuxfoundation.org>
Date: Mon, 12 Jul 2021 08:01:24 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Rocky Liao <rjliao@...eaurora.org>,
Pavel Skripkin <paskripkin@...il.com>,
Johan Hovold <johan@...nel.org>,
Marcel Holtmann <marcel@...tmann.org>
Subject: [PATCH 5.12 001/700] Bluetooth: hci_qca: fix potential GPF
From: Pavel Skripkin <paskripkin@...il.com>
commit 59f90f1351282ea2dbd0c59098fd9bb2634e920e upstream.
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@...r.kernel.org # v5.6+
Cc: Rocky Liao <rjliao@...eaurora.org>
Signed-off-by: Pavel Skripkin <paskripkin@...il.com>
Reviewed-by: Johan Hovold <johan@...nel.org>
Signed-off-by: Marcel Holtmann <marcel@...tmann.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/bluetooth/hci_qca.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1820,8 +1820,6 @@ static void qca_power_shutdown(struct hc
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 hc
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);
Powered by blists - more mailing lists