From: Toby Gray <toby.gray-BiNz9QiKYoNBDgjK7y7TUQ@public.gmane.org>
To: Oliver Neukum <oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 4/5] usb: usbnet: Add validation of dev->maxpacket to usbnet
Date: Thu, 16 Feb 2012 10:55:05 +0000 [thread overview]
Message-ID: <4F3CE089.5000105@realvnc.com> (raw)
In-Reply-To: <201202152034.03000.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
On 15/02/12 19:34, Oliver Neukum wrote:
> Am Mittwoch, 15. Februar 2012, 15:47:40 schrieb Toby Gray:
>> 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-BiNz9QiKYoNBDgjK7y7TUQ@public.gmane.org>
>> ---
>> 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;
> Hm. I am sceptical. If this happens a subdriver is buggy. We should
> not hide that. I am afraid I have to reject this patch.
That's understandable, I almost didn't include it in the series. The
only reason I added this to the patch series was because I spent a while
trying to track down a division by zero, when it turns out it was
actually due to dev->maxpacket being zero when usbnet_start_xmit tried
to calculate length % dev->maxpacket.
Would you prefer that I drop this patch entirely or just change it to
something like a BUG_ON?
Regards,
Toby
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-02-16 10:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-15 14:47 [PATCH 0/5] Delay selecting alternate setting in CDC NCM until network interface is raised Toby Gray
2012-02-15 14:47 ` [PATCH 1/5] usb: cdc-ncm: Change alternate setting magic numbers into #defines Toby Gray
[not found] ` <1329317261-3406-2-git-send-email-toby.gray-BiNz9QiKYoNBDgjK7y7TUQ@public.gmane.org>
2012-02-16 18:34 ` Alexey Orishko
[not found] ` <1329317261-3406-1-git-send-email-toby.gray-BiNz9QiKYoNBDgjK7y7TUQ@public.gmane.org>
2012-02-15 14:47 ` [PATCH 2/5] usb: cdc-ncm: Set altsetting only when network interface is opened Toby Gray
[not found] ` <1329317261-3406-3-git-send-email-toby.gray-BiNz9QiKYoNBDgjK7y7TUQ@public.gmane.org>
2012-02-17 9:57 ` Alexey Orishko
[not found] ` <CAL_Kpj01s=jCr5wkyaLanFUGFO4bsUcgHt+vP9W9mKAPA4Sh5Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-02-17 10:31 ` Toby Gray
2012-02-15 14:47 ` [PATCH 3/5] usb: usbnet: Allow drivers using usbnet to specify maximum packet size Toby Gray
[not found] ` <1329317261-3406-4-git-send-email-toby.gray-BiNz9QiKYoNBDgjK7y7TUQ@public.gmane.org>
2012-02-15 19:35 ` Oliver Neukum
2012-02-15 14:47 ` [PATCH 4/5] usb: usbnet: Add validation of dev->maxpacket to usbnet Toby Gray
2012-02-15 19:34 ` Oliver Neukum
[not found] ` <201202152034.03000.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2012-02-16 10:55 ` Toby Gray [this message]
2012-02-15 14:47 ` [PATCH 5/5] usb: cdc-ncm: Allow NCM driver to determine dev->maxpacket Toby Gray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F3CE089.5000105@realvnc.com \
--to=toby.gray-binz9qikyonbdgjk7y7tuq@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.