提交 7022cfdf 编写于 作者: S Sudip Mukherjee 提交者: Felipe Balbi

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: NSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 9ffecb10
...@@ -159,8 +159,10 @@ static int ep_bd_list_alloc(struct bdc_ep *ep) ...@@ -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, bd_table->start_bd = dma_pool_alloc(bdc->bd_table_pool,
GFP_ATOMIC, GFP_ATOMIC,
&dma); &dma);
if (!bd_table->start_bd) if (!bd_table->start_bd) {
kfree(bd_table);
goto fail; goto fail;
}
bd_table->dma = dma; bd_table->dma = dma;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册