Skip to contentSkip to conversation

bluetooth: btusb: check for NULL in btusb_find_altsetting()

PATCH In review Sathish Narasimman 2 participants 2 messages Apr 8, 2020 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 drivers/bluetooth/btusb.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/bluetooth/btusb.c +3 -0
index 110e96b245e5..2e715a6232dc 100644
@@ -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];
Signature · 1 line
2.17.1
maintainer
#1 lore raw

Hi Satish,

Quoted 7 lines

The new btusb_find_altsetting() dereferences it without checking the check is added in this patch

---
drivers/bluetooth/btusb.c | 3 +++

1 file changed, 3 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel