[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230504194626.3807438-44-sashal@kernel.org>
Date: Thu, 4 May 2023 15:46:21 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Max Chou <max.chou@...ltek.com>,
Luiz Augusto von Dentz <luiz.von.dentz@...el.com>,
Sasha Levin <sashal@...nel.org>, marcel@...tmann.org,
johan.hedberg@...il.com, luiz.dentz@...il.com,
linux-bluetooth@...r.kernel.org
Subject: [PATCH AUTOSEL 6.1 44/49] Bluetooth: btrtl: check for NULL in btrtl_set_quirks()
From: Max Chou <max.chou@...ltek.com>
[ 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@...ltek.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@...el.com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/bluetooth/btrtl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 6b3755345427a..88f8c604d70a2 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,
--
2.39.2
Powered by blists - more mailing lists