Skip to content

Commit

Permalink
media: c8sectpfe: fix double free in configure_channels()
Browse files Browse the repository at this point in the history
The configure_channels() function has a double free because
configure_memdma_and_inputblock() calls free_input_block() and then
it's called again in the error handling code.

Link: https://lore.kernel.org/linux-media/20211208073544.GA22020@kili
Fixes: c5f5d0f ("[media] c8sectpfe: STiH407/10 Linux DVB demux support")
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Patrice Chotard <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
Dan Carpenter authored and mchehab committed Dec 14, 2021
1 parent 43f0633 commit 232c297
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,6 @@ static int c8sectpfe_remove(struct platform_device *pdev)
static int configure_channels(struct c8sectpfei *fei)
{
int index = 0, ret;
struct channel_info *tsin;
struct device_node *child, *np = fei->dev->of_node;

/* iterate round each tsin and configure memdma descriptor and IB hw */
Expand All @@ -943,10 +942,9 @@ static int configure_channels(struct c8sectpfei *fei)
return 0;

err_unmap:
for (index = 0; index < fei->tsin_count; index++) {
tsin = fei->channel_data[index];
free_input_block(fei, tsin);
}
while (--index >= 0)
free_input_block(fei, fei->channel_data[index]);

return ret;
}

Expand Down

0 comments on commit 232c297

Please sign in to comment.