From: <max.chou@realtek.com>
To: <marcel@holtmann.org>
Cc: <johan.hedberg@gmail.com>, <luiz.dentz@gmail.com>,
<linux-bluetooth@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<alex_lu@realsil.com.cn>, <hildawu@realtek.com>,
<max.chou@realtek.com>
Subject: [PATCH 1/1] Bluetooth: btrtl: check for NULL in btrtl_set_quirks()
Date: Tue, 21 Mar 2023 19:48:26 +0800 [thread overview]
Message-ID: <20230321114826.3544-1-max.chou@realtek.com> (raw)
From: Max Chou <max.chou@realtek.com>
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>
---
drivers/bluetooth/btrtl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 8fa7733812ad..0f256a8abef4 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -905,6 +905,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.34.1
next reply other threads:[~2023-03-21 11:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 11:48 max.chou [this message]
2023-03-21 12:46 ` [1/1] Bluetooth: btrtl: check for NULL in btrtl_set_quirks() bluez.test.bot
2023-03-29 19:50 ` [PATCH 1/1] " patchwork-bot+bluetooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230321114826.3544-1-max.chou@realtek.com \
--to=max.chou@realtek.com \
--cc=alex_lu@realsil.com.cn \
--cc=hildawu@realtek.com \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox