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 11/15] net: enetc: restore VF MAC promiscuous mode after FLR for ENETC v4
Date: Thu, 11 Jun 2026 09:47:39 +0000 [thread overview]
Message-ID: <20260611094740.CD94F1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260610091844.3423693-12-wei.fang@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Untrusted VFs retain expansive multicast hash filters when trust is revoked.
- [Low] Comment logic inversion regarding PF-set flags in `enetc_msg_psi_free`.
--
commit 39a4c53c34896221262cf925fccff9665bc34780
Author: Wei Fang <wei.fang@nxp.com>
net: enetc: restore VF MAC promiscuous mode after FLR for ENETC v4
This commit addresses a security vulnerability on ENETC v4 where a VF FLR
resets the MAC promiscuous mode to enabled. The patch tracks the PF-managed
promiscuous state, updates it on VF requests and trust revocation, and adds
an FLR handler to restore the tracked state after an FLR.
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_msg.c b/drivers/net/ethernet/freescale/enetc/enetc_msg.c
> --- a/drivers/net/ethernet/freescale/enetc/enetc_msg.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_msg.c
[ ... ]
> @@ -725,8 +765,21 @@ static void enetc_msg_psi_free(struct enetc_pf *pf)
> /* PSIIER interrupts may be re-enabled by workqueue */
> enetc_disable_psiier_interrupts(pf);
>
> - for (i = 0; i < pf->num_vfs; i++)
> + for (i = 0; i < pf->num_vfs; i++) {
> + struct enetc_vf_state *vf_state = &pf->vf_state[i];
> +
> enetc_msg_free_mbx(si, i);
> +
> + /* VF may set these flags by mailbox messages, so need to
> + * clear these flags when enetc_msg_psi_free() is called.
> + * Flags set by PF are cleared, because these flags are
> + * unrelated to whether SR-IOV is enabled or disabled.
> + */
[Severity: Low]
This isn't a bug, but should the comment say "Flags set by PF are NOT
cleared"?
The bitwise AND operation below exclusively clears the promiscuous flags
set by the VF while preserving flags set by the PF, such as
ENETC_VF_FLAG_TRUSTED.
> + mutex_lock(&vf_state->lock);
> + vf_state->flags &= ~(ENETC_VF_FLAG_UC_PROMISC |
> + ENETC_VF_FLAG_MC_PROMISC);
> + mutex_unlock(&vf_state->lock);
> + }
> }
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c
> --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c
[ ... ]
> @@ -480,7 +480,9 @@ int enetc_pf_set_vf_trust(struct net_device *ndev, int vf, bool setting)
> if (setting) {
> vf_state->flags |= ENETC_VF_FLAG_TRUSTED;
> } else {
> - vf_state->flags &= ~ENETC_VF_FLAG_TRUSTED;
> + vf_state->flags &= ~(ENETC_VF_FLAG_TRUSTED |
> + ENETC_VF_FLAG_UC_PROMISC |
> + ENETC_VF_FLAG_MC_PROMISC);
>
> /* Clear unicast hash filter and disable MAC promiscuous modes
> * if the VF is untrusted.
> */
[Severity: High]
Does this leave untrusted VFs with an expansive multicast hash filter when
trust is revoked?
When a VF is trusted, it can set a broad 64-bit multicast hash filter,
while untrusted VFs are restricted to 8 bits. When an administrator revokes
trust, the PF clears the unicast hash filter and disables MAC promiscuous
modes, but it doesn't appear to clear the multicast hash filter here.
Could a previously trusted VF retain its expansive multicast hash filter
after trust is revoked, bypassing the security policy?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260610091844.3423693-1-wei.fang@oss.nxp.com?part=11
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 [this message]
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
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=20260611094740.CD94F1F00898@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.