[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180319162649.GT14921@uda0271908>
Date: Mon, 19 Mar 2018 11:26:49 -0500
From: Bin Liu <b-liu@...com>
To: Heinrich Schuchardt <xypron.glpk@....de>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] usb: musb: gadget: misplaced out of bounds check
Hi,
On Mon, Mar 19, 2018 at 08:12:28AM +0100, 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>
> ---
> drivers/usb/musb/musb_gadget_ep0.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
> index 18da4873e52e..482e7c2f8dc7 100644
> --- a/drivers/usb/musb/musb_gadget_ep0.c
> +++ b/drivers/usb/musb/musb_gadget_ep0.c
> @@ -88,6 +88,11 @@ static int service_tx_status_request(
> break;
> }
>
> + if (epnum >= MUSB_C_NUM_EPS) {
only the LSB 4 bits are the EP number, bit7 is the direction flag. So
you can only compare the LSB 4 bits here.
Regards,
-Bin.
Powered by blists - more mailing lists