From: Ma Ke <make24@iscas.ac.cn>
To: lpieralisi@kernel.org, kw@linux.com, mani@kernel.org,
kishon@kernel.org, bhelgaas@google.com, jpinto@synopsys.com
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Ma Ke <make24@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] PCI: endpoint: Fix a double free in __pci_epc_create()
Date: Tue, 7 Jan 2025 15:46:01 +0800 [thread overview]
Message-ID: <20250107074601.789649-1-make24@iscas.ac.cn> (raw)
The put_device(&epc->dev) call will trigger pci_epc_release() which
frees "epc" so the kfree(epc) on the next line is a double free.
Found by code review.
Cc: stable@vger.kernel.org
Fixes: 5e8cb4033807 ("PCI: endpoint: Add EP core layer to enable EP controller and EP functions")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
drivers/pci/endpoint/pci-epc-core.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index 46c9a5c3ca14..652350f054cf 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -818,7 +818,6 @@ __pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
put_dev:
put_device(&epc->dev);
- kfree(epc);
err_ret:
return ERR_PTR(ret);
--
2.25.1
next reply other threads:[~2025-01-07 7:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 7:46 Ma Ke [this message]
2025-01-14 0:57 ` [PATCH] PCI: endpoint: Fix a double free in __pci_epc_create() Krzysztof Wilczyński
2025-02-20 16:23 ` Krzysztof Wilczyński
-- strict thread matches above, loose matches on Subject: below --
2025-01-02 9:30 Ma Ke
2025-01-03 10:28 ` Markus Elfring
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=20250107074601.789649-1-make24@iscas.ac.cn \
--to=make24@iscas.ac.cn \
--cc=bhelgaas@google.com \
--cc=jpinto@synopsys.com \
--cc=kishon@kernel.org \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=stable@vger.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 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.