* [PATCH] media: atomisp: double free in atomisp_alloc_css_stat_bufs()
@ 2021-02-01 12:26 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-02-01 12:26 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Sakari Ailus, Greg Kroah-Hartman, Rahul Gottipati, Alan Cox,
linux-media, devel, kernel-janitors
The "s3a_buf" has already been added to the "&asd->s3a_stats" list
and it gets cleaned up in the error handling code at the end of
the function. This kfree() leads to a use after free and a double
free. Delete it.
Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
index 2ae50decfc8b..9da82855552d 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
@@ -948,10 +948,8 @@ int atomisp_alloc_css_stat_bufs(struct atomisp_sub_device *asd,
dev_dbg(isp->dev, "allocating %d dis buffers\n", count);
while (count--) {
dis_buf = kzalloc(sizeof(struct atomisp_dis_buf), GFP_KERNEL);
- if (!dis_buf) {
- kfree(s3a_buf);
+ if (!dis_buf)
goto error;
- }
if (atomisp_css_allocate_stat_buffers(
asd, stream_id, NULL, dis_buf, NULL)) {
kfree(dis_buf);
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] media: atomisp: double free in atomisp_alloc_css_stat_bufs()
@ 2021-02-01 12:26 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-02-01 12:26 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: devel, Greg Kroah-Hartman, kernel-janitors, Sakari Ailus,
Alan Cox, linux-media
The "s3a_buf" has already been added to the "&asd->s3a_stats" list
and it gets cleaned up in the error handling code at the end of
the function. This kfree() leads to a use after free and a double
free. Delete it.
Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
index 2ae50decfc8b..9da82855552d 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
@@ -948,10 +948,8 @@ int atomisp_alloc_css_stat_bufs(struct atomisp_sub_device *asd,
dev_dbg(isp->dev, "allocating %d dis buffers\n", count);
while (count--) {
dis_buf = kzalloc(sizeof(struct atomisp_dis_buf), GFP_KERNEL);
- if (!dis_buf) {
- kfree(s3a_buf);
+ if (!dis_buf)
goto error;
- }
if (atomisp_css_allocate_stat_buffers(
asd, stream_id, NULL, dis_buf, NULL)) {
kfree(dis_buf);
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] media: atomisp: double free in atomisp_alloc_css_stat_bufs()
@ 2021-02-01 12:26 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-02-01 12:26 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: devel, Greg Kroah-Hartman, kernel-janitors, Sakari Ailus,
Alan Cox, linux-media
The "s3a_buf" has already been added to the "&asd->s3a_stats" list
and it gets cleaned up in the error handling code at the end of
the function. This kfree() leads to a use after free and a double
free. Delete it.
Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
index 2ae50decfc8b..9da82855552d 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
@@ -948,10 +948,8 @@ int atomisp_alloc_css_stat_bufs(struct atomisp_sub_device *asd,
dev_dbg(isp->dev, "allocating %d dis buffers\n", count);
while (count--) {
dis_buf = kzalloc(sizeof(struct atomisp_dis_buf), GFP_KERNEL);
- if (!dis_buf) {
- kfree(s3a_buf);
+ if (!dis_buf)
goto error;
- }
if (atomisp_css_allocate_stat_buffers(
asd, stream_id, NULL, dis_buf, NULL)) {
kfree(dis_buf);
--
2.29.2
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-01 12:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 12:26 [PATCH] media: atomisp: double free in atomisp_alloc_css_stat_bufs() Dan Carpenter
2021-02-01 12:26 ` Dan Carpenter
2021-02-01 12:26 ` Dan Carpenter
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.