From: sashiko-bot@kernel.org
To: wei.fang@oss.nxp.com
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v2 net-next 14/15] net: enetc: add PSI-to-VSI link status notification support for VF
Date: Thu, 11 Jun 2026 09:47:42 +0000 [thread overview]
Message-ID: <20260611094742.B12861F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260610091844.3423693-15-wei.fang@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Race condition in VF message workqueue teardown leading to unhandled hardware interrupts.
--
commit 56c5e3ce01133d9549230bbfb6889bc307567cb5
Author: Wei Fang <wei.fang@nxp.com>
net: enetc: add PSI-to-VSI link status notification support for VF
This commit adds infrastructure for ENETC v4 VFs to track PF link status
changes via the PSI-to-VSI messaging channel. A dedicated MSI-X vector
handles incoming messages and schedules a work item to update the carrier
state.
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/ethernet/freescale/enetc/enetc_vf.c
> index dc9a0f74a2e34..ba7686fb32ce9 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c
[ ... ]
> @@ -415,6 +461,122 @@ static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
[ ... ]
> +static void enetc_vf_msg_task(struct work_struct *work)
> +{
[ ... ]
> + /* If ndev is in the NETREG_UNREGISTERED state, return directly
> + * without processing the message or enabling MR interrupt. Any
> + * future caller that reuses this work item after the device
> + * returns to a registered state should enable MR interrupt again.
> + */
> + if (ndev->reg_state == NETREG_UNREGISTERED)
> + return;
> +
[ ... ]
> + enetc_vf_enable_mr_int(hw);
> +}
[Severity: High]
Can this task re-enable hardware interrupts after the OS IRQ handler has
been freed?
If this work item executes during a probe failure or races with
unregister_netdev() during remove, the ndev->reg_state check might not
protect it. During a probe failure, the state is NETREG_UNINITIALIZED, and
during remove, this check can race with the state change.
[ ... ]
> @@ -493,6 +683,18 @@ static int enetc_vf_probe(struct pci_dev *pdev,
[ ... ]
> err_reg_netdev:
> + enetc_vf_free_msg_msix(si);
> +err_register_msg_msix:
> + enetc_vf_wq_task_destroy(si);
> +err_wq_init:
> enetc_free_msix(priv);
[Severity: High]
Can this teardown order cause an unhandled hardware interrupt?
If enetc_vf_free_msg_msix() frees the OS IRQ before enetc_vf_wq_task_destroy()
drains and disables the workqueue, the work task could run and unmask the
hardware interrupt while the handler is already gone.
Should enetc_vf_wq_task_destroy() be called before freeing the IRQ?
[ ... ]
> @@ -528,7 +734,8 @@ static void enetc_vf_remove(struct pci_dev *pdev)
>
> priv = netdev_priv(si->ndev);
> unregister_netdev(si->ndev);
> -
> + enetc_vf_free_msg_msix(si);
> + enetc_vf_wq_task_destroy(si);
[Severity: High]
Similar to the probe error path, does freeing the IRQ before destroying
the workqueue allow the work item to execute and re-enable the hardware
interrupt after the handler is unregistered?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260610091844.3423693-1-wei.fang@oss.nxp.com?part=14
next prev parent reply other threads:[~2026-06-11 9:47 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-10 9:18 [PATCH v2 net-next 00/15] net: enetc: SR-IOV improvements and ENETC v4 VF support wei.fang
2026-06-10 9:18 ` [PATCH v2 net-next 01/15] net: enetc: add trusted " wei.fang
2026-06-10 9:18 ` [PATCH v2 net-next 02/15] net: enetc: move msg_task and msg_int_name to struct enetc_si wei.fang
2026-06-10 9:18 ` [PATCH v2 net-next 03/15] net: enetc: add link status message support to PF driver wei.fang
2026-06-11 9:47 ` sashiko-bot
2026-06-10 9:18 ` [PATCH v2 net-next 04/15] net: enetc: add link speed " wei.fang
2026-06-11 9:47 ` sashiko-bot
2026-06-10 9:18 ` [PATCH v2 net-next 05/15] net: enetc: use enetc_set_si_hw_addr() to set VF MAC address wei.fang
2026-06-10 9:18 ` [PATCH v2 net-next 06/15] net: enetc: relocate enetc_pf_set_vf_mac() for common PF support wei.fang
2026-06-10 9:18 ` [PATCH v2 net-next 07/15] net: enetc: add .ndo_set_vf_mac() to the enetc v4 driver wei.fang
2026-06-11 9:47 ` sashiko-bot
2026-06-10 9:18 ` [PATCH v2 net-next 08/15] net: enetc: move mac_filter from struct enetc_pf to struct enetc_si wei.fang
2026-06-11 9:47 ` sashiko-bot
2026-06-10 9:18 ` [PATCH v2 net-next 09/15] net: enetc: add MAC address filtering support for VFs of ENETC v4 wei.fang
2026-06-11 9:47 ` sashiko-bot
2026-06-10 9:18 ` [PATCH v2 net-next 10/15] net: enetc: simplify and rename PSIIER enable/disable helpers wei.fang
2026-06-10 9:18 ` [PATCH v2 net-next 11/15] net: enetc: restore VF MAC promiscuous mode after FLR for ENETC v4 wei.fang
2026-06-11 9:47 ` sashiko-bot
2026-06-10 9:18 ` [PATCH v2 net-next 12/15] net: enetc: add VF support for i.MX94 and i.MX95 wei.fang
2026-06-10 9:18 ` [PATCH v2 net-next 13/15] net: enetc: implement ndo_set_rx_mode_async for ENETC v4 VF wei.fang
2026-06-11 9:47 ` sashiko-bot
2026-06-10 9:18 ` [PATCH v2 net-next 14/15] net: enetc: add PSI-to-VSI link status notification support for VF wei.fang
2026-06-11 9:47 ` sashiko-bot [this message]
2026-06-10 9:18 ` [PATCH v2 net-next 15/15] net: enetc: add ndo_get_vf_config() support wei.fang
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=20260611094742.B12861F00898@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wei.fang@oss.nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.