From: sashiko-bot@kernel.org
To: "Manivannan Sadhasivam" <mani@kernel.org>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 1/8] PCI/ASPM: Always disable ASPM when driver requests it
Date: Wed, 08 Jul 2026 14:44:41 +0000 [thread overview]
Message-ID: <20260708144442.5F4621F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260708-pci-aspm-fix-v3-1-6bd72451746e@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Race condition leading to Use-After-Free in ASPM link state management.
--
--- Patch [1]: [PATCH v3 1/8] PCI/ASPM: Always disable ASPM when driver requests it ---
commit 3f3308cae9c38dfb61e4a9d6f6d9f1413c0e0c87
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
PCI/ASPM: Always disable ASPM when driver requests it
This commit makes pci_disable_link_state() unconditionally disable ASPM so
the motivation for drivers to use custom ASPM handling code is eliminated.
This ensures ASPM state changes are properly tracked by the service driver.
Link: https://lore.kernel.org/all/CANUX_P3F5YhbZX3WGU-j1AGpbXb_T9Bis2ErhvKkFMtDvzatVQ@mail.gmail.com/
Link: https://lore.kernel.org/all/20230511131441.45704-1-ilpo.jarvinen@linux.intel.com/
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -1449,16 +1449,23 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool locked
> {
> struct pcie_link_state *link = pcie_aspm_get_link(pdev);
>
> if (!link)
> return -EINVAL;
[ ... ]
> if (!locked)
> down_read(&pci_bus_sem);
> mutex_lock(&aspm_lock);
> link->aspm_disable |= pci_calc_aspm_disable_mask(state);
[Severity: High]
This is a pre-existing issue, but could this lockless fetch of the link
pointer lead to a use-after-free when we write to aspm_disable here?
If one CPU calls this asynchronously (for example, from a network driver TX
timeout handler) and another CPU concurrently removes a sibling PCI function
on the same bridge, could we hit this sequence:
CPU1
__pci_disable_link_state()
link = pcie_aspm_get_link(pdev);
CPU2
pcie_aspm_exit_link_state()
// acquires locks, frees parent bridge's link pointer
bridge->link_state = NULL;
kfree(link);
CPU1
mutex_lock(&aspm_lock);
link->aspm_disable |= pci_calc_aspm_disable_mask(state);
Could this concurrent removal cause the link pointer to be freed before
CPU1 acquires the locks, leading to memory corruption when modified?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260708-pci-aspm-fix-v3-0-6bd72451746e@kernel.org?part=1
next prev parent reply other threads:[~2026-07-08 14:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 14:30 [PATCH v3 0/8] PCI/ASPM: Add pci_force_enable_link_state() API and convert Atheros drivers Manivannan Sadhasivam
2026-07-08 14:30 ` [PATCH v3 1/8] PCI/ASPM: Always disable ASPM when driver requests it Manivannan Sadhasivam
2026-07-08 14:44 ` sashiko-bot [this message]
2026-07-08 14:30 ` [PATCH v3 2/8] PCI/ASPM: Add pci_force_enable_link_state() API Manivannan Sadhasivam
2026-07-08 14:44 ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 3/8] PCI/ASPM: Transition the device to D0 (if required) when enabling ASPM link states Manivannan Sadhasivam
2026-07-08 14:50 ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 4/8] PCI/ASPM: Improve the kernel-doc for pci_{enable,disable}_link_state*() APIs Manivannan Sadhasivam
2026-07-08 14:37 ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 5/8] PCI/ASPM: Return enabled ASPM states from pcie_aspm_enabled() API Manivannan Sadhasivam
2026-07-08 14:36 ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 6/8] wifi: ath12k: Use pci_{enable/disable}_link_state() APIs to enable/disable ASPM states Manivannan Sadhasivam
2026-07-08 14:49 ` sashiko-bot
2026-07-10 20:25 ` Bjorn Helgaas
2026-07-08 14:30 ` [PATCH v3 7/8] wifi: ath11k: " Manivannan Sadhasivam
2026-07-08 14:47 ` sashiko-bot
2026-07-08 14:30 ` [PATCH v3 8/8] wifi: ath10k: " Manivannan Sadhasivam
2026-07-08 14:51 ` sashiko-bot
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=20260708144442.5F4621F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mani@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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