diff mbox series

[1/1] Bluetooth: btrtl: check for NULL in btrtl_set_quirks()

Message ID 20230321114826.3544-1-max.chou@realtek.com (mailing list archive)
State Accepted
Commit dfa0a31c0cee1fe133282aac6bef0538adadca64
Headers show
Series [1/1] Bluetooth: btrtl: check for NULL in btrtl_set_quirks() | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse warning CheckSparse WARNING drivers/bluetooth/btrtl.c: note: in included file:drivers/bluetooth/btrtl.h:52:45: warning: array of flexible structures
tedd_an/CheckSmatch warning CheckSparse WARNING drivers/bluetooth/btrtl.c: note: in included file:drivers/bluetooth/btrtl.h:52:45: warning: array of flexible structures
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Max Chou March 21, 2023, 11:48 a.m. UTC
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(+)

Comments

bluez.test.bot@gmail.com March 21, 2023, 12:46 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=732307

---Test result---

Test Summary:
CheckPatch                    PASS      0.61 seconds
GitLint                       PASS      0.26 seconds
SubjectPrefix                 PASS      0.07 seconds
BuildKernel                   PASS      42.76 seconds
CheckAllWarning               PASS      46.48 seconds
CheckSparse                   WARNING   51.75 seconds
CheckSmatch                   WARNING   140.61 seconds
BuildKernel32                 PASS      41.67 seconds
TestRunnerSetup               PASS      598.45 seconds
TestRunner_l2cap-tester       PASS      21.26 seconds
TestRunner_iso-tester         PASS      23.67 seconds
TestRunner_bnep-tester        PASS      7.61 seconds
TestRunner_mgmt-tester        PASS      142.76 seconds
TestRunner_rfcomm-tester      PASS      11.92 seconds
TestRunner_sco-tester         PASS      10.86 seconds
TestRunner_ioctl-tester       PASS      13.19 seconds
TestRunner_mesh-tester        PASS      9.47 seconds
TestRunner_smp-tester         PASS      10.67 seconds
TestRunner_userchan-tester    PASS      8.01 seconds
IncrementalBuild              PASS      38.68 seconds

Details
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:
drivers/bluetooth/btrtl.c: note: in included file:drivers/bluetooth/btrtl.h:52:45: warning: array of flexible structures
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
drivers/bluetooth/btrtl.c: note: in included file:drivers/bluetooth/btrtl.h:52:45: warning: array of flexible structures


---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org March 29, 2023, 7:50 p.m. UTC | #2
Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue, 21 Mar 2023 19:48:26 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [1/1] Bluetooth: btrtl: check for NULL in btrtl_set_quirks()
    https://git.kernel.org/bluetooth/bluetooth-next/c/dfa0a31c0cee

You are awesome, thank you!
diff mbox series

Patch

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,