Skip to content

Commit

Permalink
ARM: PL08x: fix a leak when preparing TXDs
Browse files Browse the repository at this point in the history
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 <rmk+kernel@arm.linux.org.uk>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
  • Loading branch information
Russell King - ARM Linux authored and Dan Williams committed Jan 5, 2011
1 parent bf072af commit dafa731
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/dma/amba-pl08x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit dafa731

Please sign in to comment.