[U-Boot] [PATCH V3 10/20] usb: gadget: ether: return error from rx_submit if no request

Marek Vasut
2013-08-02T11:07:58Z

Dear Troy Kisky,

> This prevents a crash if tftpboot is given a bad filename.

How is bad filename related to struct usb_request?

> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> ---
> drivers/usb/gadget/ether.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
> index f583c6e..fe73c7b 100644
> --- a/drivers/usb/gadget/ether.c
> +++ b/drivers/usb/gadget/ether.c
> @@ -1535,6 +1535,8 @@ static int rx_submit(struct eth_dev *dev, struct
> usb_request *req, */
>
> debug("%s\n", __func__);
> + if (!req)
> + return -EINVAL;
>
> size = (ETHER_HDR_SIZE + dev->mtu + RX_EXTRA);
> size += dev->out_ep->maxpacket - 1;

Best regards,
Marek Vasut