All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cdc-acm: fix NULL pointer reference
@ 2016-01-07 10:01 Oliver Neukum
  2016-01-10  2:01 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 2016-01-07 10:01 UTC (permalink / raw)
  To: davem, netdev, galkin-vv; +Cc: Oliver Neukum

The union descriptor must be checked. Its usage was conditional
before the parser was introduced. This is important, because
many RNDIS device, which also use the common parser, have
bogus extra descriptors.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Tested-by: Vasily Galkin <galkin-vv@yandex.ru>
---
 drivers/net/usb/cdc_ether.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 3da70bf..7cba2c3 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -160,6 +160,12 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
 	info->u = header.usb_cdc_union_desc;
 	info->header = header.usb_cdc_header_desc;
 	info->ether = header.usb_cdc_ether_desc;
+	if (!info->u) {
+		if (rndis)
+			goto skip;
+		else /* in that case a quirk is mandatory */
+			goto bad_desc;
+	}
 	/* we need a master/control interface (what we're
 	 * probed with) and a slave/data interface; union
 	 * descriptors sort this all out.
@@ -256,7 +262,7 @@ skip:
 			goto bad_desc;
 		}
 
-	} else if (!info->header || !info->u || (!rndis && !info->ether)) {
+	} else if (!info->header || (!rndis && !info->ether)) {
 		dev_dbg(&intf->dev, "missing cdc %s%s%sdescriptor\n",
 			info->header ? "" : "header ",
 			info->u ? "" : "union ",
-- 
2.1.4

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

* Re: [PATCH] cdc-acm: fix NULL pointer reference
  2016-01-07 10:01 [PATCH] cdc-acm: fix NULL pointer reference Oliver Neukum
@ 2016-01-10  2:01 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-01-10  2:01 UTC (permalink / raw)
  To: oneukum; +Cc: netdev, galkin-vv

From: Oliver Neukum <oneukum@suse.com>
Date: Thu,  7 Jan 2016 11:01:00 +0100

> The union descriptor must be checked. Its usage was conditional
> before the parser was introduced. This is important, because
> many RNDIS device, which also use the common parser, have
> bogus extra descriptors.
> 
> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> Tested-by: Vasily Galkin <galkin-vv@yandex.ru>

Applied, thanks Oliver.

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

end of thread, other threads:[~2016-01-10  2:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07 10:01 [PATCH] cdc-acm: fix NULL pointer reference Oliver Neukum
2016-01-10  2:01 ` David Miller

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.