summary refs log tree commit diff
diff options
context:
space:
mode:
authorMax Chou <max.chou@realtek.com>2023-03-21 19:48:26 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-24 17:32:39 +0100
commitea160ece08668a30ce69f92cc08e87da54a64a9c (patch)
treecea8b1d13892b279415c9ca2727a425fc6f351f0
parentf4f3cbdbf2c8e2f39944b2c8a8b03ca87064f9a5 (diff)
downloadlinux-ea160ece08668a30ce69f92cc08e87da54a64a9c.tar.gz
Bluetooth: btrtl: check for NULL in btrtl_set_quirks()
[ Upstream commit 253cf30e8d3d001850a95c4729d668f916b037ab ]

The btrtl_set_quirks() has accessed btrtl_dev->ic_info->lmp_subver since
b8e482d02513. However, if installing a Realtek Bluetooth controller
without the driver supported, it will hit the NULL point accessed.

Add a check for NULL to avoid the Kernel Oops.

Signed-off-by: Max Chou <max.chou@realtek.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/bluetooth/btrtl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 6b3755345427..88f8c604d70a 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -882,6 +882,9 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)
 		break;
 	}
 
+	if (!btrtl_dev->ic_info)
+		return;
+
 	switch (btrtl_dev->ic_info->lmp_subver) {
 	case RTL_ROM_LMP_8703B:
 		/* 8723CS reports two pages for local ext features,