From: Sathish Narasimman Date: Wed, 8 Apr 2020 05:27:03 +0000 (+0530) Subject: Bluetooth: btusb: check for NULL in btusb_find_altsetting() X-Git-Tag: v5.8-rc1~165^2~503^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fcd156ee8bc6a989dbf7e5efbccdc9cdb831fd27;p=thirdparty%2Flinux.git Bluetooth: btusb: check for NULL in btusb_find_altsetting() The new btusb_find_altsetting() dereferences it without checking the check is added in this patch Signed-off-by: Sathish Narasimman Signed-off-by: Marcel Holtmann --- diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 09913cadd1ca1..871162790a0ed 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -1622,6 +1622,9 @@ static struct usb_host_interface *btusb_find_altsetting(struct btusb_data *data, BT_DBG("Looking for Alt no :%d", alt); + if (!intf) + return NULL; + for (i = 0; i < intf->num_altsetting; i++) { if (intf->altsetting[i].desc.bAlternateSetting == alt) return &intf->altsetting[i];