netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: Toby Gray <toby.gray@realvnc.com>
Cc: Toby Gray <tg@realvnc.com>, Oliver Neukum <oliver@neukum.name>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	alexey.orishko@gmail.com
Subject: Re: [PATCH 4/5] usb: usbnet: Add validation of dev->maxpacket to usbnet
Date: Wed, 15 Feb 2012 20:34:02 +0100	[thread overview]
Message-ID: <201202152034.03000.oliver@neukum.org> (raw)
In-Reply-To: <1329317261-3406-5-git-send-email-toby.gray@realvnc.com>

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@realvnc.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;

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.

	Regards
		Oliver

  reply	other threads:[~2012-02-15 19:31 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 [this message]
     [not found]     ` <201202152034.03000.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2012-02-16 10:55       ` Toby Gray
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=201202152034.03000.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=alexey.orishko@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oliver@neukum.name \
    --cc=tg@realvnc.com \
    --cc=toby.gray@realvnc.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).