[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1279718128-2367-1-git-send-email-ajb@spheresystems.co.uk>
Date: Wed, 21 Jul 2010 14:15:28 +0100
From: Andrew Bird <ajb@...eresystems.co.uk>
To: linux-kernel@...r.kernel.org
Cc: ajb@...eresystems.co.uk
Subject: [PATCH 1/2] USB - Option.c obey reserved interface flag
---
drivers/usb/serial/option.c | 43 ++++++++++++++++++++++++++-----------------
1 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index e280ad8..8a1008c 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -997,10 +997,29 @@ static void __exit option_exit(void)
module_init(option_init);
module_exit(option_exit);
+static enum option_blacklist_reason is_blacklisted(const u8 ifnum,
+ const struct option_blacklist_info *blacklist)
+{
+ const u8 *info;
+ int i;
+
+ if (blacklist) {
+ info = blacklist->ifaceinfo;
+
+ for (i = 0; i < blacklist->infolen; i++) {
+ if (info[i] == ifnum)
+ return blacklist->reason;
+ }
+ }
+ return OPTION_BLACKLIST_NONE;
+}
+
static int option_probe(struct usb_serial *serial,
const struct usb_device_id *id)
{
struct usb_wwan_intf_private *data;
+ int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber;
+
/* D-Link DWM 652 still exposes CD-Rom emulation interface in modem mode */
if (serial->dev->descriptor.idVendor == DLINK_VENDOR_ID &&
serial->dev->descriptor.idProduct == DLINK_PRODUCT_DWM_652 &&
@@ -1013,6 +1032,13 @@ static int option_probe(struct usb_serial *serial,
serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff)
return -ENODEV;
+ /* Don't bind reserved interfaces */
+ if (is_blacklisted(ifNum, (void *)id->driver_info) ==
+ OPTION_BLACKLIST_RESERVED_IF) {
+ dbg("No bind on blacklisted interface #%d\n", ifNum);
+ return -ENODEV;
+ }
+
data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
if (!data)
@@ -1023,23 +1049,6 @@ static int option_probe(struct usb_serial *serial,
return 0;
}
-static enum option_blacklist_reason is_blacklisted(const u8 ifnum,
- const struct option_blacklist_info *blacklist)
-{
- const u8 *info;
- int i;
-
- if (blacklist) {
- info = blacklist->ifaceinfo;
-
- for (i = 0; i < blacklist->infolen; i++) {
- if (info[i] == ifnum)
- return blacklist->reason;
- }
- }
- return OPTION_BLACKLIST_NONE;
-}
-
static void option_instat_callback(struct urb *urb)
{
int err;
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists