[PATCH 09/14] usb: dfu: fix error path to avoid NULL ptr deref
Lucas Stach
dev at lynxeye.de
Fri Feb 7 03:48:51 EST 2014
Signed-off-by: Lucas Stach <dev at lynxeye.de>
---
drivers/usb/gadget/dfu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/dfu.c b/drivers/usb/gadget/dfu.c
index e15fc41..4d4c347 100644
--- a/drivers/usb/gadget/dfu.c
+++ b/drivers/usb/gadget/dfu.c
@@ -597,8 +597,10 @@ static int dfu_bind_config(struct usb_configuration *c)
func->disable = dfu_disable;
dfu->dnreq = usb_ep_alloc_request(c->cdev->gadget->ep0);
- if (!dfu->dnreq)
+ if (!dfu->dnreq) {
printf("usb_ep_alloc_request failed\n");
+ goto out;
+ }
dfu->dnreq->buf = dma_alloc(CONFIG_USBD_DFU_XFER_SIZE);
dfu->dnreq->complete = dn_complete;
dfu->dnreq->zero = 0;
--
1.8.5.3
More information about the barebox
mailing list