From: Rihyeon Kim <rihyeon8648@gmail.com>
To: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
gregkh@linuxfoundation.org, tarunsahu@google.com,
djeffery@redhat.com,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>
Subject: [PATCH v2 0/2] PCI: Fix dev_set_name() error handling in pci_setup_device()
Date: Sun, 26 Jul 2026 18:31:58 +0900 [thread overview]
Message-ID: <20260726093200.146111-1-rihyeon8648@gmail.com> (raw)
Hi,
pci_setup_device() calls dev_set_name() without checking it. syzbot hits
this with fault injection, where it turns into a WARNING and then a NULL
pointer dereference. Patch 1 checks the return value and propagates it.
Patch 2 is the neighboring leak on the "unknown header type" path, where
the name that dev_set_name() allocated is never freed. It was reported by
Yang Yingliang in 2022, and Krzysztof suggested picking it up here.
I am not sure about the attribution on patch 2, since most of it is Yang
Yingliang's fix with the NULL assignment added. If it should look
different, or if that patch would be better sent on its own, please let me
know and I will respin.
This is my first patch to the kernel, so please let me know if I got
anything wrong about the form.
v1: https://lore.kernel.org/linux-pci/20260725104747.226575-1-rihyeon8648@gmail.com/
v2:
- 1/2: Fixes: points at 1fa5ae857bb1 rather than eebfcfb52ce7, since
dev_set_name() could not fail before that commit (Krzysztof)
- 1/2: update the kernel-doc for the new return value (Krzysztof)
- 1/2: say kvasprintf_const() rather than kvasprintf() in the commit log
(Krzysztof)
- 1/2: pick up Reviewed-by
- 2/2: new patch (Krzysztof)
Thanks,
Rihyeon
Rihyeon Kim (2):
PCI: Handle dev_set_name() failure in pci_setup_device()
PCI: Free the device name on the pci_setup_device() error path
drivers/pci/probe.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
next reply other threads:[~2026-07-26 9:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-26 9:31 Rihyeon Kim [this message]
2026-07-26 9:31 ` [PATCH v2 1/2] PCI: Handle dev_set_name() failure " Rihyeon Kim
2026-08-04 13:31 ` tarunsahu
2026-08-06 9:42 ` Rihyeon Kim
2026-08-07 19:27 ` David Jeffery
2026-07-26 9:32 ` [PATCH v2 2/2] PCI: Free the device name on the pci_setup_device() error path Rihyeon Kim
2026-08-07 19:45 ` David Jeffery
2026-08-18 5:57 ` Rihyeon Kim
2026-08-18 6:12 ` [PATCH v2 0/2] PCI: Fix dev_set_name() error handling in pci_setup_device() Rihyeon Kim
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=20260726093200.146111-1-rihyeon8648@gmail.com \
--to=rihyeon8648@gmail.com \
--cc=bhelgaas@google.com \
--cc=djeffery@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=tarunsahu@google.com \
/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®