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] [day] [month] [year] [list]
Date:   Tue, 20 Mar 2018 12:36:30 +0300
From:   Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:     Heinrich Schuchardt <xypron.glpk@....de>, Bin Liu <b-liu@...com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/1] usb: musb: gadget: misplaced out of bounds check

Hello!

On 3/20/2018 5:27 AM, Heinrich Schuchardt wrote:

> musb->endpoints[] has array size MUSB_C_NUM_EPS.
> We must check array bounds before accessing the array and not afterwards.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@....de>
> ---
> v2
> 	Only the 4 low bits of epnum are relevant for indexing.	
> ---
>   drivers/usb/musb/musb_gadget_ep0.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
> index 18da4873e52e..96b0fa12f729 100644
> --- a/drivers/usb/musb/musb_gadget_ep0.c
> +++ b/drivers/usb/musb/musb_gadget_ep0.c
> @@ -89,15 +89,20 @@ static int service_tx_status_request(
>   		}
>   
>   		is_in = epnum & USB_DIR_IN;
> +		epnum &= 0x0f;
> +		if (epnum >= MUSB_C_NUM_EPS) {
> +			handled = -EINVAL;
> +			break;
> +		}
> +
>   		if (is_in) {
> -			epnum &= 0x0f;
>   			ep = &musb->endpoints[epnum].ep_in;
>   		} else {
>   			ep = &musb->endpoints[epnum].ep_out;
>   		}

    Please remove the braces, they're not needed anymore.

[...]

MBR, Sergei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ