All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Oliver Neukum <oneukum@suse.com>
Cc: syzbot+48a2851be24583b864dc@syzkaller.appspotmail.com,
	linux-usb@vger.kernel.org
Subject: Re: WARNING in dln2_start_rx_urbs/usb_submit_urb
Date: Mon, 9 Dec 2019 12:26:04 +0000	[thread overview]
Message-ID: <20191209122604.GH3468@dell> (raw)
In-Reply-To: <1574263316.14298.36.camel@suse.com>

On Wed, 20 Nov 2019, Oliver Neukum wrote:

> #syz test: https://github.com/google/kasan.git b1aa9d83
> 
> From 6f3de1e2c53fcee54d90a6891df9cea763eca86b Mon Sep 17 00:00:00 2001
> From: Oliver Neukum <oneukum@suse.com>
> Date: Wed, 20 Nov 2019 16:15:13 +0100
> Subject: [PATCH] mfd: dln2: more sanity checking for endpoints
> 
> It is not enough to check for the number of endpoints.
> The types must also be correct.
> 
> Reported-by: syzbot+48a2851be24583b864dc@syzkaller.appspotmail.com
> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> ---
>  drivers/mfd/dln2.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)

Looks okay in principle.

It would be great if one of the USB guys could take a quick look.

Is this not something that could be done at a subsystem level?

> diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
> index 381593fbe50f..7841c11411d0 100644
> --- a/drivers/mfd/dln2.c
> +++ b/drivers/mfd/dln2.c
> @@ -722,6 +722,8 @@ static int dln2_probe(struct usb_interface *interface,
>  		      const struct usb_device_id *usb_id)
>  {
>  	struct usb_host_interface *hostif = interface->cur_altsetting;
> +	struct usb_endpoint_descriptor *epin;
> +	struct usb_endpoint_descriptor *epout;
>  	struct device *dev = &interface->dev;
>  	struct dln2_dev *dln2;
>  	int ret;
> @@ -731,12 +733,19 @@ static int dln2_probe(struct usb_interface *interface,
>  	    hostif->desc.bNumEndpoints < 2)
>  		return -ENODEV;
>  
> +	epin = &hostif->endpoint[0].desc;
> +	epout = &hostif->endpoint[1].desc;
> +	if (!usb_endpoint_is_bulk_out(epout))
> +		return -ENODEV;
> +	if (!usb_endpoint_is_bulk_in(epin))
> +		return -ENODEV;
> +
>  	dln2 = kzalloc(sizeof(*dln2), GFP_KERNEL);
>  	if (!dln2)
>  		return -ENOMEM;
>  
> -	dln2->ep_out = hostif->endpoint[0].desc.bEndpointAddress;
> -	dln2->ep_in = hostif->endpoint[1].desc.bEndpointAddress;
> +	dln2->ep_out = epout->bEndpointAddress;
> +	dln2->ep_in = epin->bEndpointAddress;
>  	dln2->usb_dev = usb_get_dev(interface_to_usbdev(interface));
>  	dln2->interface = interface;
>  	usb_set_intfdata(interface, dln2);

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  parent reply	other threads:[~2019-12-09 12:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-20 15:21 WARNING in dln2_start_rx_urbs/usb_submit_urb Oliver Neukum
2019-11-21  0:06 ` syzbot
2019-12-09 12:26 ` Lee Jones [this message]
2019-12-09 12:33   ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2019-11-06 12:32 syzbot

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=20191209122604.GH3468@dell \
    --to=lee.jones@linaro.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    --cc=syzbot+48a2851be24583b864dc@syzkaller.appspotmail.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 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.