[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1329317261-3406-5-git-send-email-toby.gray@realvnc.com>
Date: Wed, 15 Feb 2012 14:47:40 +0000
From: Toby Gray <toby.gray@...lvnc.com>
To: Toby Gray <tg@...lvnc.com>, Oliver Neukum <oliver@...kum.name>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-usb@...r.kernel.org
Cc: netdev@...r.kernel.org, alexey.orishko@...il.com,
Toby Gray <toby.gray@...lvnc.com>
Subject: [PATCH 4/5] usb: usbnet: Add validation of dev->maxpacket to usbnet
Several parts of usbnet rely on dev->maxpacket not being set to 0 to
prevent division by zero errors.
This adds validation of the dev->maxpacket value being non-zero before
treating the device probe as successful.
Signed-off-by: Toby Gray <toby.gray@...lvnc.com>
---
drivers/net/usb/usbnet.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 4ccd316..1491c90 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1427,6 +1427,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
dev->rx_urb_size = dev->hard_mtu;
if (!dev->maxpacket)
dev->maxpacket = usb_maxpacket(dev->udev, dev->out, 1);
+ if (!dev->maxpacket) {
+ status = -ENODEV;
+ goto out3;
+ }
if ((dev->driver_info->flags & FLAG_WLAN) != 0)
SET_NETDEV_DEVTYPE(net, &wlan_type);
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists