From: Russell King - ARM Linux Date: Mon, 3 Jan 2011 22:31:45 +0000 (+0000) Subject: ARM: PL08x: fix a leak when preparing TXDs X-Git-Tag: v2.6.38-rc1~25^2~11^2~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dafa73171be8dd31b485f5839e3376b1ca908e24;p=platform%2Fkernel%2Flinux-exynos.git ARM: PL08x: fix a leak when preparing TXDs If we fail to allocate the LLI, the prep_* function will return NULL. However, the TXD we allocated will not be placed on any list, nor will it be freed - we'll just drop all references to it. Make sure we free it rather than leaking TXDs. Signed-off-by: Russell King Acked-by: Linus Walleij Signed-off-by: Dan Williams --- diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 69cfb05..b3b3180 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -1332,9 +1332,10 @@ static int pl08x_prep_channel_resources(struct pl08x_dma_chan *plchan, int ret; num_llis = pl08x_fill_llis_for_desc(pl08x, txd); - - if (!num_llis) + if (!num_llis) { + kfree(txd); return -EINVAL; + } spin_lock_irqsave(&plchan->lock, plchan->lockflags);