From: sashiko-bot@kernel.org
To: "Haiyang Zhang" <haiyangz@linux.microsoft.com>
Cc: linux-hyperv@vger.kernel.org
Subject: Re: [PATCH net-next v4] net: mana: Add handler for sriov configure
Date: Sat, 11 Jul 2026 19:27:57 +0000 [thread overview]
Message-ID: <20260711192757.B29911F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260710192735.2921300-1-haiyangz@linux.microsoft.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Uncancelled background works (`mana_serv_work` and `mana_dev_recovery_work`) lead to Use-After-Free of `gdma_context` during device removal.
--
--- Patch [1]: [PATCH net-next v4] net: mana: Add handler for sriov configure ---
commit d651d90ceb3e1716b100c2eb4035662f066b67fa
Author: Haiyang Zhang <haiyangz@microsoft.com>
net: mana: Add handler for sriov configure
This commit adds a callback function for the pci_driver / sriov_configure
interface. It requests the NIC to provide a specific number of VFs, or
disables VFs if the requested number is zero.
> diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> index aef3b77229c13..a38d4bb74621f 100644
> --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> @@ -2456,6 +2456,8 @@ static void mana_gd_remove(struct pci_dev *pdev)
> {
> struct gdma_context *gc = pci_get_drvdata(pdev);
>
> + pci_disable_sriov(pdev);
> +
> mana_rdma_remove(&gc->mana_ib);
> mana_remove(&gc->mana, false);
[Severity: High]
This is a pre-existing issue, but can this lead to a Use-After-Free of
gdma_context if there are uncancelled background works?
When mana_gd_remove() executes, it eventually frees the gdma_context via
vfree(gc) without flushing works like mana_serv_work or
mana_dev_recovery_work that might be pending on the system_wq.
If a hardware event triggers mana_gd_process_eqe() and schedules
serv_work before a hot-unplug, could the scheduled work run after
mana_gd_remove() has freed the context?
The worker thread mana_serv_func() calls mana_serv_reset(), which does:
struct gdma_context *gc = pci_get_drvdata(pdev);
...
hwc = gc->hwc.driver_data;
Since the PCI core only clears drvdata after remove() returns, this could
dereference the freed gc memory. Should these background works be
cancelled before freeing the context?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260710192735.2921300-1-haiyangz@linux.microsoft.com?part=1
prev parent reply other threads:[~2026-07-11 19:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 19:27 [PATCH net-next v4] net: mana: Add handler for sriov configure Haiyang Zhang
2026-07-11 19:27 ` 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=20260711192757.B29911F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=haiyangz@linux.microsoft.com \
--cc=linux-hyperv@vger.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