[PATCH 21/23] USB: gadget: fsl_udc: Be more tolerant in fsl_ep_dequeue
Sascha Hauer
s.hauer at pengutronix.de
Mon Jul 21 08:14:45 PDT 2014
When an endpoint hasn't been enabled ep->desc is NULL and
fsl_ep_dequeue crashes with a NULL pointer dereference. Check
ep->desc before continuing.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/usb/gadget/fsl_udc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/fsl_udc.c b/drivers/usb/gadget/fsl_udc.c
index 5266fb6..5a625d1 100644
--- a/drivers/usb/gadget/fsl_udc.c
+++ b/drivers/usb/gadget/fsl_udc.c
@@ -1280,7 +1280,7 @@ static int fsl_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
int ep_num, stopped, ret = 0;
u32 epctrl;
- if (!_ep || !_req)
+ if (!_ep || !_req || !ep->desc)
return -EINVAL;
stopped = ep->stopped;
--
2.0.1
More information about the barebox
mailing list