Bluetooth: btrtl: check for NULL in btrtl_set_quirks()
authorMax Chou <max.chou@realtek.com>
Tue, 21 Mar 2023 11:48:26 +0000 (19:48 +0800)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 24 Apr 2023 04:57:00 +0000 (21:57 -0700)
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>
drivers/bluetooth/btrtl.c

index 8fa7733..0f256a8 100644 (file)
@@ -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,