lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 9 Nov 2017 10:30:33 -0500 (EST)
From:   Alan Stern <stern@...land.harvard.edu>
To:     Oliver Neukum <oneukum@...e.com>
cc:     Andrey Konovalov <andreyknvl@...gle.com>,
        <vskrishn@...eaurora.org>, <krinkin.m.u@...il.com>,
        <syzkaller-bugs@...glegroups.com>,
        Felipe Balbi <felipe.balbi@...ux.intel.com>,
        Greg KH <gregkh@...uxfoundation.org>,
        Takashi Iwai <tiwai@...e.de>,
        syzbot 
        <bot+50d191d34989b5aa28596b0a2cb20c96f3ca4650@...kaller.appspotmail.com>,
        LKML <linux-kernel@...r.kernel.org>,
        USB list <linux-usb@...r.kernel.org>
Subject: Re: WARNING in usb_submit_urb

On Thu, 9 Nov 2017, Oliver Neukum wrote:

> Am Donnerstag, den 09.11.2017, 13:19 +0100 schrieb Andrey Konovalov:
> > 
> > This isn't the "BOGUS urb xfer" warning, this is "BOGUS urb flags". So
> > 2 means the URB_ISO_ASAP flag, which is passed in urb->transfer_flags
> > but not allowed. And as far as I understand, it gets set because uurb
> > (which is passed from user space) has USBDEVFS_URB_ISO_ASAP flag set
> > when passed to proc_do_submiturb().
> 
> Hi,
> 
> yes we should filter better.
> Could you test?
> 
> 	Regards
> 		Oliver

> Subject: [PATCH] USB: usbfs: Filter flags passed in from user space
> 
> USBDEVFS_URB_ISO_ASAP must be accepted only for ISO endpoints.
> Improve sanity checking.
> 
> Signed-off-by: Oliver Neukum <oneukum@...e.com>
> ---
>  drivers/usb/core/devio.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index c3aaafc25a04..abe6457516a2 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -1473,6 +1473,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
>  	case USBDEVFS_URB_TYPE_CONTROL:
>  		if (!usb_endpoint_xfer_control(&ep->desc))
>  			return -EINVAL;
> +		if (uurb->flags & USBDEVFS_URB_ISO_ASAP)
> +			return -EINVAL;
>  		/* min 8 byte setup packet */
>  		if (uurb->buffer_length < 8)
>  			return -EINVAL;
> @@ -1511,6 +1513,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
>  		break;
>  
>  	case USBDEVFS_URB_TYPE_BULK:
> +		if (uurb->flags & USBDEVFS_URB_ISO_ASAP)
> +			return -EINVAL;
>  		switch (usb_endpoint_type(&ep->desc)) {
>  		case USB_ENDPOINT_XFER_CONTROL:
>  		case USB_ENDPOINT_XFER_ISOC:

You need to check interrupt URBs also.  It would be best to have a
single test before the big "switch" statement:

	if ((uurb->flags & USBDEVFS_URB_ISO_ASAP) &&
			uurb->type != USBDEVFS_URB_TYPE_ISOCHRONOUS)
		return -EINVAL;

Alan Stern

Powered by blists - more mailing lists