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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yn9XwHxWsLIJXlHu@kroah.com>
Date:   Sat, 14 May 2022 09:18:24 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Zheyu Ma <zheyuma97@...il.com>
Cc:     eli.billauer@...il.com, arnd@...db.de, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] char: xillybus: Check endpoint type properly

On Sat, May 14, 2022 at 03:14:35PM +0800, Zheyu Ma wrote:
> The driver submits bulk urb without checking the endpoint type is
> actually bulk.
> 
> [    3.108411] ------------[ cut here ]------------
> [    3.108690] usb 1-1: BOGUS urb xfer, pipe 3 != type 1
> [    3.108983] WARNING: CPU: 0 PID: 211 at drivers/usb/core/urb.c:503 usb_submit_urb+0xcd9/0x18b0
> [    3.110976] RIP: 0010:usb_submit_urb+0xcd9/0x18b0
> [    3.115318] Call Trace:
> [    3.115452]  <TASK>
> [    3.115570]  try_queue_bulk_in+0x43c/0x6e0 [xillyusb]
> [    3.115838]  xillyusb_probe+0x488/0x1230 [xillyusb]
> 
> Add a check to fix it.
> 
> Fixes: a53d1202aef1 ("char: xillybus: Add driver for XillyUSB (Xillybus variant for USB)")
> Signed-off-by: Zheyu Ma <zheyuma97@...il.com>
> ---
>  drivers/char/xillybus/xillyusb.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/char/xillybus/xillyusb.c b/drivers/char/xillybus/xillyusb.c
> index 39bcbfd908b4..2ec2e087b2e7 100644
> --- a/drivers/char/xillybus/xillyusb.c
> +++ b/drivers/char/xillybus/xillyusb.c
> @@ -730,6 +730,11 @@ static void try_queue_bulk_in(struct xillyusb_endpoint *ep)
>  
>  		usb_anchor_urb(urb, &ep->anchor);
>  
> +		if (usb_urb_ep_type_check(urb)) {
> +			report_io_error(xdev, -EINVAL);
> +			goto unanchor;
> +		}
> +
>  		rc = usb_submit_urb(urb, GFP_KERNEL);
>  
>  		if (rc) {
> @@ -834,6 +839,11 @@ static void try_queue_bulk_out(struct xillyusb_endpoint *ep)
>  
>  		usb_anchor_urb(urb, &ep->anchor);
>  
> +		if (usb_urb_ep_type_check(urb)) {
> +			report_io_error(xdev, -EINVAL);
> +			goto unanchor;
> +		}
> +
>  		rc = usb_submit_urb(urb, GFP_KERNEL);
>  
>  		if (rc) {
> -- 
> 2.25.1
> 

This should all be checked much earlier, in your probe function, to make
sure you have the endpoints correct.  Just refuse to bind to a device
that is not correct.  Don't check late here when you are submitting the
urb.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ