diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-12-08 08:35:44 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2021-12-14 16:19:04 +0100 |
commit | 232c297a4e86fba1e2497012b1fcde6018d46f50 (patch) | |
tree | 9dc0878b1a88c68caa6cdf59b7082dca4e359762 | |
parent | 43f0633f89947df57fe0b5025bdd741768007708 (diff) | |
download | linux-232c297a4e86fba1e2497012b1fcde6018d46f50.tar.bz2 |
media: c8sectpfe: fix double free in configure_channels()
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: c5f5d0f99794 ("[media] c8sectpfe: STiH407/10 Linux DVB demux support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r-- | drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c index e1f520903248..7bb1384e4bad 100644 --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c @@ -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 */ @@ -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; } |