linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: qca: Fix nullptr dereference for non-serdev devices
@ 2024-04-17  3:49 Zijun Hu
  2024-04-17  4:34 ` bluez.test.bot
  2024-04-17  6:30 ` [PATCH] " Johan Hovold
  0 siblings, 2 replies; 12+ messages in thread
From: Zijun Hu @ 2024-04-17  3:49 UTC (permalink / raw)
  To: luiz.dentz, marcel; +Cc: quic_zijuhu, linux-bluetooth, johan+linaro

hu->serdev is nullptr and will cause nullptr dereference if qca_setup()
is called by non-serdev device, fixed by null check before access.

Fixes: 77f45cca8bc5 ("Bluetooth: qca: fix device-address endianness")
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
 drivers/bluetooth/hci_qca.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 92fa20f5ac7d..9c6573c727e1 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1905,10 +1905,11 @@ static int qca_setup(struct hci_uart *hu)
 	case QCA_WCN6750:
 	case QCA_WCN6855:
 	case QCA_WCN7850:
-		qcadev = serdev_device_get_drvdata(hu->serdev);
-		if (qcadev->bdaddr_property_broken)
-			set_bit(HCI_QUIRK_BDADDR_PROPERTY_BROKEN, &hdev->quirks);
-
+		if (hu->serdev) {
+			qcadev = serdev_device_get_drvdata(hu->serdev);
+			if (qcadev->bdaddr_property_broken)
+				set_bit(HCI_QUIRK_BDADDR_PROPERTY_BROKEN, &hdev->quirks);
+		}
 		hci_set_aosp_capable(hdev);
 
 		ret = qca_read_soc_version(hdev, &ver, soc_type);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-04-18 23:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-17  3:49 [PATCH] Bluetooth: qca: Fix nullptr dereference for non-serdev devices Zijun Hu
2024-04-17  4:34 ` bluez.test.bot
2024-04-17  6:30 ` [PATCH] " Johan Hovold
2024-04-17  6:51   ` quic_zijuhu
2024-04-17  7:10     ` Johan Hovold
2024-04-17  7:32       ` quic_zijuhu
2024-04-17  8:32         ` Johan Hovold
2024-04-17  9:38           ` quic_zijuhu
2024-04-17  9:41             ` quic_zijuhu
2024-04-18 15:59             ` Johan Hovold
2024-04-18 17:07               ` Luiz Augusto von Dentz
2024-04-18 23:04               ` quic_zijuhu

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).