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

Troy Kisky
2013-08-01T23:27:27Z

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 | 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;
--
1.8.1.2