diff mbox series

Bluetooth: btrtl: check for NULL in btrtl_setup_realtek()

Message ID 20241231065719.4840-1-max.chou@realtek.com
State Accepted
Commit 402e07c75d0758c7d21d57a1207c568cd9bbdad8
Headers show
Series Bluetooth: btrtl: check for NULL in btrtl_setup_realtek() | expand

Commit Message

Max Chou Dec. 31, 2024, 6:57 a.m. UTC
From: Max Chou <max.chou@realtek.com>

If insert an USB dongle which chip is not maintained in ic_id_table, it
will hit the NULL point accessed. Add a null point check to avoid the
Kernel Oops.

Fixes: b39910bb54d9 ("Bluetooth: Populate hci_set_hw_info for Intel and Realtek")
Reviewed-by: Alex Lu <alex_lu@realsil.com.cn>
Signed-off-by: Max Chou <max.chou@realtek.com>
---
 drivers/bluetooth/btrtl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

patchwork-bot+bluetooth@kernel.org Jan. 9, 2025, 4:17 p.m. UTC | #1
Hello:

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

On Tue, 31 Dec 2024 14:57:19 +0800 you wrote:
> From: Max Chou <max.chou@realtek.com>
> 
> If insert an USB dongle which chip is not maintained in ic_id_table, it
> will hit the NULL point accessed. Add a null point check to avoid the
> Kernel Oops.
> 
> Fixes: b39910bb54d9 ("Bluetooth: Populate hci_set_hw_info for Intel and Realtek")
> Reviewed-by: Alex Lu <alex_lu@realsil.com.cn>
> Signed-off-by: Max Chou <max.chou@realtek.com>
> 
> [...]

Here is the summary with links:
  - Bluetooth: btrtl: check for NULL in btrtl_setup_realtek()
    https://git.kernel.org/bluetooth/bluetooth-next/c/402e07c75d07

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 83025f457ca0..d3eba0d4a57d 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -1351,12 +1351,14 @@  int btrtl_setup_realtek(struct hci_dev *hdev)
 
 	btrtl_set_quirks(hdev, btrtl_dev);
 
-	hci_set_hw_info(hdev,
+	if (btrtl_dev->ic_info) {
+		hci_set_hw_info(hdev,
 			"RTL lmp_subver=%u hci_rev=%u hci_ver=%u hci_bus=%u",
 			btrtl_dev->ic_info->lmp_subver,
 			btrtl_dev->ic_info->hci_rev,
 			btrtl_dev->ic_info->hci_ver,
 			btrtl_dev->ic_info->hci_bus);
+	}
 
 	btrtl_free(btrtl_dev);
 	return ret;