|
|
9e9264a |
From 29c6dd591bbd592472247441de9fa694acdabae8 Mon Sep 17 00:00:00 2001
|
|
|
9e9264a |
From: Oliver Neukum <oneukum@suse.com>
|
|
|
9e9264a |
Date: Thu, 7 Jan 2016 11:01:00 +0100
|
|
|
9e9264a |
Subject: [PATCH] cdc-acm: fix NULL pointer reference
|
|
|
9e9264a |
|
|
|
9e9264a |
The union descriptor must be checked. Its usage was conditional
|
|
|
9e9264a |
before the parser was introduced. This is important, because
|
|
|
9e9264a |
many RNDIS device, which also use the common parser, have
|
|
|
9e9264a |
bogus extra descriptors.
|
|
|
9e9264a |
|
|
|
9e9264a |
Signed-off-by: Oliver Neukum <oneukum@suse.com>
|
|
|
9e9264a |
Tested-by: Vasily Galkin <galkin-vv@yandex.ru>
|
|
|
9e9264a |
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
|
9e9264a |
---
|
|
|
9e9264a |
drivers/net/usb/cdc_ether.c | 8 +++++++-
|
|
|
9e9264a |
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
9e9264a |
|
|
|
9e9264a |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
|
|
|
9e9264a |
index 3da70bf..7cba2c3 100644
|
|
|
9e9264a |
--- a/drivers/net/usb/cdc_ether.c
|
|
|
9e9264a |
+++ b/drivers/net/usb/cdc_ether.c
|
|
|
9e9264a |
@@ -160,6 +160,12 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
|
|
|
9e9264a |
info->u = header.usb_cdc_union_desc;
|
|
|
9e9264a |
info->header = header.usb_cdc_header_desc;
|
|
|
9e9264a |
info->ether = header.usb_cdc_ether_desc;
|
|
|
9e9264a |
+ if (!info->u) {
|
|
|
9e9264a |
+ if (rndis)
|
|
|
9e9264a |
+ goto skip;
|
|
|
9e9264a |
+ else /* in that case a quirk is mandatory */
|
|
|
9e9264a |
+ goto bad_desc;
|
|
|
9e9264a |
+ }
|
|
|
9e9264a |
/* we need a master/control interface (what we're
|
|
|
9e9264a |
* probed with) and a slave/data interface; union
|
|
|
9e9264a |
* descriptors sort this all out.
|
|
|
9e9264a |
@@ -256,7 +262,7 @@ skip:
|
|
|
9e9264a |
goto bad_desc;
|
|
|
9e9264a |
}
|
|
|
9e9264a |
|
|
|
9e9264a |
- } else if (!info->header || !info->u || (!rndis && !info->ether)) {
|
|
|
9e9264a |
+ } else if (!info->header || (!rndis && !info->ether)) {
|
|
|
9e9264a |
dev_dbg(&intf->dev, "missing cdc %s%s%sdescriptor\n",
|
|
|
9e9264a |
info->header ? "" : "header ",
|
|
|
9e9264a |
info->u ? "" : "union ",
|
|
|
9e9264a |
--
|
|
|
9e9264a |
2.5.0
|
|
|
9e9264a |
|