From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-kernel@vger.kernel.org>, <linux-pci@vger.kernel.org>
Cc: <bhelgaas@google.com>
Subject: [PATCH -next 1/2] PCI: fix possible memory leak in error case in pci_setup_device()
Date: Wed, 17 Aug 2022 16:44:43 +0800 [thread overview]
Message-ID: <20220817084444.2876059-1-yangyingliang@huawei.com> (raw)
If pci_setup_device() fails, the device name need be freed
to avoid memory leak.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/pci/probe.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index c5286b027f00..0e947f24153e 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1976,6 +1976,7 @@ int pci_setup_device(struct pci_dev *dev)
default: /* unknown header */
pci_err(dev, "unknown header type %02x, ignoring device\n",
dev->hdr_type);
+ kfree_const(dev->dev.kobj.name);
pci_release_of_node(dev);
return -EIO;
--
2.25.1
next reply other threads:[~2022-08-17 8:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-17 8:44 Yang Yingliang [this message]
2022-08-17 8:44 ` [PATCH -next 2/2] PCI: switch to use dev_err_probe() Yang Yingliang
2022-08-17 9:11 ` Christophe JAILLET
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=20220817084444.2876059-1-yangyingliang@huawei.com \
--to=yangyingliang@huawei.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®