Bluetooth: hci_qca: fix potential GPF
authorPavel Skripkin <paskripkin@gmail.com>
Mon, 3 May 2021 10:06:05 +0000 (13:06 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:55:34 +0000 (16:55 +0200)
commit3cdcbd1b8ce3e8e9fff364e3a939c6052598139f
tree9141f50081369161ce8ba4b48e51edeecc58d9f8
parent904ad453baa0aae7189ebd07f0d43cb694fb2987
Bluetooth: hci_qca: fix potential GPF

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@vger.kernel.org # v5.6+
Cc: Rocky Liao <rjliao@codeaurora.org>
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/bluetooth/hci_qca.c