All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bluetooth: btusb: check for NULL in btusb_find_altsetting()
@ 2020-04-08  5:27 Sathish Narasimman
  2020-04-08  6:17 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Sathish Narasimman @ 2020-04-08  5:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sathish Narasimman

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>
---
 drivers/bluetooth/btusb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 110e96b245e5..2e715a6232dc 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];
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] bluetooth: btusb: check for NULL in btusb_find_altsetting()
  2020-04-08  5:27 [PATCH] bluetooth: btusb: check for NULL in btusb_find_altsetting() Sathish Narasimman
@ 2020-04-08  6:17 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2020-04-08  6:17 UTC (permalink / raw)
  To: Sathish Narasimman; +Cc: Bluez mailing list, Sathish Narasimman

Hi Satish,

> 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>
> ---
> drivers/bluetooth/btusb.c | 3 +++
> 1 file changed, 3 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-08  6:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08  5:27 [PATCH] bluetooth: btusb: check for NULL in btusb_find_altsetting() Sathish Narasimman
2020-04-08  6:17 ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.