summaryrefslogtreecommitdiff
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorSathish Narasimman <nsathish41@gmail.com>2020-04-08 10:57:03 +0530
committerMarcel Holtmann <marcel@holtmann.org>2020-04-08 08:16:56 +0200
commitfcd156ee8bc6a989dbf7e5efbccdc9cdb831fd27 (patch)
tree78655072d2cacc5d887603be2200dc3c4050a8a9 /drivers/bluetooth
parentd1d900f822b6b2874de9c1ef8094fc8df56a2f9f (diff)
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 <sathish.narasimman@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/btusb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 09913cadd1ca..871162790a0e 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];