From: Dan Carpenter <dan.carpenter@oracle.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: Vinod Koul <vkoul@kernel.org>,
dmaengine@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] dmaengine: idxd: double free of devm_ memory on probe error
Date: Sat, 8 May 2021 11:20:41 +0300 [thread overview]
Message-ID: <YJZJ2Z5CEqQC5s+1@mwanda> (raw)
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
next reply other threads:[~2021-05-08 8:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-08 8:20 Dan Carpenter [this message]
2021-05-10 0:38 ` [PATCH] dmaengine: idxd: remove devm allocation for idxd->int_handles Dave Jiang
2021-05-10 15:50 ` Vinod Koul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YJZJ2Z5CEqQC5s+1@mwanda \
--to=dan.carpenter@oracle.com \
--cc=dave.jiang@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).