kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: idxd: double free of devm_ memory on probe error
@ 2021-05-08  8:20 Dan Carpenter
  2021-05-10  0:38 ` [PATCH] dmaengine: idxd: remove devm allocation for idxd->int_handles Dave Jiang
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2021-05-08  8:20 UTC (permalink / raw)
  To: Dave Jiang; +Cc: Vinod Koul, dmaengine, kernel-janitors

The "idxd->int_handles" pointer is allocated with devm_kcalloc() so
freeing it here leads to a double free.  Delete the kfree().

Fixes: eb15e7154fbf ("dmaengine: idxd: add interrupt handle request and release support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/dma/idxd/init.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
index 2a926bef87f2..b65d28895955 100644
--- a/drivers/dma/idxd/init.c
+++ b/drivers/dma/idxd/init.c
@@ -318,7 +318,7 @@ static int idxd_setup_internals(struct idxd_device *idxd)
 
 	rc = idxd_setup_wqs(idxd);
 	if (rc < 0)
-		goto err_wqs;
+		return rc;
 
 	rc = idxd_setup_engines(idxd);
 	if (rc < 0)
@@ -345,8 +345,6 @@ static int idxd_setup_internals(struct idxd_device *idxd)
  err_engine:
 	for (i = 0; i < idxd->max_wqs; i++)
 		put_device(&idxd->wqs[i]->conf_dev);
- err_wqs:
-	kfree(idxd->int_handles);
 	return rc;
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-10 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-08  8:20 [PATCH] dmaengine: idxd: double free of devm_ memory on probe error Dan Carpenter
2021-05-10  0:38 ` [PATCH] dmaengine: idxd: remove devm allocation for idxd->int_handles Dave Jiang
2021-05-10 15:50   ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).