From: sashiko-bot@kernel.org
To: "Ziheng Wei" <zihengw03@163.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: endpoint: check epf->epc and epf->sec_epc under locks in pci_epc_add_epf()
Date: Sun, 06 Dec 2026 08:44:28 +0000 [thread overview]
Message-ID: <sashiko-outbox-252296@kernel.org> (raw)
In-Reply-To: <20261206082942.1296-1-zihengw03@163.com>
> pci_epc_add_epf() checks epf->epc and epf->sec_epc before acquiring
> epc->list_lock or epf->lock. Concurrent calls binding the same EPF via
> configfs can both pass the unlocked check, allocate two function numbers,
> and call list_add_tail() twice on the same list_head, corrupting
> epc->pci_epf.
>
> Acquire epc->list_lock followed by epf->lock (matching the lock order in
> pci_epc_linkup() and the other EPC notification helpers) before checking
> and updating epf->epc and epf->sec_epc, and hold epf->lock symmetrically
> in pci_epc_remove_epf().
>
> Found by LLM-assisted static analysis. Compile-tested on x86_64.
>
> Fixes: 5e8cb4033807 ("PCI: endpoint: Add EP core layer to enable EP controller and EP functions")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ziheng Wei <zihengw03@163.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261206082942.1296-1-zihengw03@163.com?part=1
prev parent reply other threads:[~2026-12-06 8:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-06 8:29 [PATCH] PCI: endpoint: check epf->epc and epf->sec_epc under locks in pci_epc_add_epf() Ziheng Wei
2026-12-06 8:44 ` sashiko-bot [this message]
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=sashiko-outbox-252296@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zihengw03@163.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