* [PATCH] media: c8sectpfe: fix double free in configure_channels()
@ 2021-12-08 7:35 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-12-08 7:35 UTC (permalink / raw)
To: Patrice Chotard, Peter Griffin
Cc: Mauro Carvalho Chehab, linux-arm-kernel, linux-media, kernel-janitors
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.
Fixes: c5f5d0f99794 ("[media] c8sectpfe: STiH407/10 Linux DVB demux support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 8 +++-----
1 file 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;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] media: c8sectpfe: fix double free in configure_channels()
@ 2021-12-08 7:35 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-12-08 7:35 UTC (permalink / raw)
To: Patrice Chotard, Peter Griffin
Cc: Mauro Carvalho Chehab, linux-arm-kernel, linux-media, kernel-janitors
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.
Fixes: c5f5d0f99794 ("[media] c8sectpfe: STiH407/10 Linux DVB demux support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 8 +++-----
1 file 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;
}
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] media: c8sectpfe: fix double free in configure_channels()
2021-12-08 7:35 ` Dan Carpenter
@ 2021-12-10 7:39 ` Patrice CHOTARD
-1 siblings, 0 replies; 4+ messages in thread
From: Patrice CHOTARD @ 2021-12-10 7:39 UTC (permalink / raw)
To: Dan Carpenter, Peter Griffin
Cc: Mauro Carvalho Chehab, linux-arm-kernel, linux-media, kernel-janitors
Hi Dan
On 12/8/21 8:35 AM, Dan Carpenter wrote:
> 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.
>
> Fixes: c5f5d0f99794 ("[media] c8sectpfe: STiH407/10 Linux DVB demux support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 8 +++-----
> 1 file 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;
> }
>
>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: c8sectpfe: fix double free in configure_channels()
@ 2021-12-10 7:39 ` Patrice CHOTARD
0 siblings, 0 replies; 4+ messages in thread
From: Patrice CHOTARD @ 2021-12-10 7:39 UTC (permalink / raw)
To: Dan Carpenter, Peter Griffin
Cc: Mauro Carvalho Chehab, linux-arm-kernel, linux-media, kernel-janitors
Hi Dan
On 12/8/21 8:35 AM, Dan Carpenter wrote:
> 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.
>
> Fixes: c5f5d0f99794 ("[media] c8sectpfe: STiH407/10 Linux DVB demux support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 8 +++-----
> 1 file 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;
> }
>
>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-10 7:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 7:35 [PATCH] media: c8sectpfe: fix double free in configure_channels() Dan Carpenter
2021-12-08 7:35 ` Dan Carpenter
2021-12-10 7:39 ` Patrice CHOTARD
2021-12-10 7:39 ` Patrice CHOTARD
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.