summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>2015-09-26 15:01:06 +0530
committerFelipe Balbi <balbi@ti.com>2015-09-30 11:20:21 -0500
commit7022cfdfe07dcfccc294f04de5f75e0a37b16174 (patch)
tree63326523e3d837c5adf52e293c0a5db8fd709d60
parent9ffecb10283508260936b96022d4ee43a7798b4c (diff)
downloadop-kernel-dev-7022cfdfe07dcfccc294f04de5f75e0a37b16174.zip
op-kernel-dev-7022cfdfe07dcfccc294f04de5f75e0a37b16174.tar.gz
usb: gadget: bdc: fix memory leak
If dma_pool_alloc() fails we are jumping to fail and releasing all the bd_tables which have been added to the chain but we missed freeing this bd_table which was just allocated and still not added to the chain of bd_table. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/gadget/udc/bdc/bdc_ep.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index d1b8153..d619950 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -159,8 +159,10 @@ static int ep_bd_list_alloc(struct bdc_ep *ep)
bd_table->start_bd = dma_pool_alloc(bdc->bd_table_pool,
GFP_ATOMIC,
&dma);
- if (!bd_table->start_bd)
+ if (!bd_table->start_bd) {
+ kfree(bd_table);
goto fail;
+ }
bd_table->dma = dma;
OpenPOWER on IntegriCloud