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

Troy Kisky troy.kisky at boundarydevices.com
Fri Aug 2 00:18:31 CEST 2013


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

Signed-off-by: Troy Kisky <troy.kisky at 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



More information about the U-Boot mailing list