[U-Boot] [PATCH RFC V1 10/18] usb: gadget: ether: return error from rx_submit if no request

Troy Kisky
2013-07-17T00:28:24Z

On 7/16/2013 1:47 PM, Troy Kisky wrote:
> This prevents a crash if tftpboot is given a bad filename.
>
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> ---
> drivers/usb/gadget/ether.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
> index e39714b..1542ca3 100644
> --- a/drivers/usb/gadget/ether.c
> +++ b/drivers/usb/gadget/ether.c
> @@ -2401,7 +2401,8 @@ static int usb_eth_init(struct eth_device *netdev, bd_t *bd)
> }
>
> packet_received = 0;
> - rx_submit(dev, dev->rx_req, 0);
> + if (dev->rx_req)
> + rx_submit(dev, dev->rx_req, 0);
> return 0;
> fail:
> return -1;
This patch is wrong. I will put the check in rx_submit, because this
call was not the problem.