From: Marcin Slusarz Fix memory leak when _ep is null. http://bugzilla.kernel.org/show_bug.cgi?id=10660 Reported-by: Daniel Marjamaki Signed-off-by: Marcin Slusarz Cc: David Brownell Cc: Greg Kroah-Hartman Signed-off-by: Andrew Morton --- drivers/usb/gadget/pxa27x_udc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff -puN drivers/usb/gadget/pxa27x_udc.c~usb-fix-possible-memory-leak-in-pxa27x_udc drivers/usb/gadget/pxa27x_udc.c --- a/drivers/usb/gadget/pxa27x_udc.c~usb-fix-possible-memory-leak-in-pxa27x_udc +++ a/drivers/usb/gadget/pxa27x_udc.c @@ -650,8 +650,11 @@ pxa_ep_alloc_request(struct usb_ep *_ep, { struct pxa27x_request *req; + if (!_ep) + return NULL; + req = kzalloc(sizeof *req, gfp_flags); - if (!req || !_ep) + if (!req) return NULL; INIT_LIST_HEAD(&req->queue); _