Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@xxxxxxxxx> --- drivers/net/usb/usbnet.c | 14 ++++++++++++-- include/linux/usb/usbnet.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 17b6a62..a635c5a 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1259,7 +1259,8 @@ static struct device_type wwan_type = { }; int -usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) +usbnet_probe_pvtsize(struct usb_interface *udev, + const struct usb_device_id *prod, size_t pvtsize) { struct usbnet *dev; struct net_device *net; @@ -1269,6 +1270,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) int status; const char *name; + BUG_ON(pvtsize < sizeof(*dev)); + name = udev->dev.driver->name; info = (struct driver_info *) prod->driver_info; if (!info) { @@ -1283,7 +1286,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) status = -ENOMEM; // set up our own records - net = alloc_etherdev(sizeof(*dev)); + net = alloc_etherdev(pvtsize); if (!net) { dbg ("can't kmalloc dev"); goto out; @@ -1409,6 +1412,13 @@ out: usb_put_dev(xdev); return status; } +EXPORT_SYMBOL_GPL(usbnet_probe_pvtsize); + +int +usbnet_probe(struct usb_interface *udev, const struct usb_device_id *prod) +{ + return usbnet_probe_pvtsize(udev, prod, sizeof(struct usbnet)); +} EXPORT_SYMBOL_GPL(usbnet_probe); /*-------------------------------------------------------------------------*/ diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index df1e83d..96bad3b 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -148,6 +148,8 @@ struct driver_info { * much everything except custom framing and chip-specific stuff. */ extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *); +extern int usbnet_probe_pvtsize(struct usb_interface *, + const struct usb_device_id *, size_t); extern int usbnet_suspend (struct usb_interface *, pm_message_t ); extern int usbnet_resume (struct usb_interface *); extern void usbnet_disconnect(struct usb_interface *); -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html