RE: [PATCH v4 net-next 11/15] net: enetc: restore VF MAC promiscuous mode after FLR for ENETC v4
From: Claudiu Manoil
Date: Fri Sep 11 2026 - 16:18:15 EST
NXP Confidential
> -----Original Message-----
> From: Wei Fang (OSS) <wei.fang@xxxxxxxxxxx>
> Sent: Wednesday, September 9, 2026 1:07 PM
[...]
> Subject: [PATCH v4 net-next 11/15] net: enetc: restore VF MAC promiscuous
> mode after FLR for ENETC v4
>
> From: Wei Fang <wei.fang@xxxxxxx>
>
> On ENETC v4, when VF performs a PCI FLR, it resets PSIPMMR[SIn_MAC_UP]
> and PSIPMMR[SIn_MAC_MP] bits, which control the unicast and multicast
> promiscuous mode for the corresponding SI. The reset (default) value of
> these bits enables promiscuous mode, meaning that after a VF FLR, the
> SI is left in promiscuous mode regardless of the configuration set by
> the PF driver prior to the reset.
>
> This is a potential security vulnerability: a malicious VM could
> deliberately trigger a VF FLR to force promiscuous mode on its SI,
> allowing it to capture network traffic not destined for that VF.
>
> To mitigate this, make the following changes:
>
> - Add ENETC_VF_FLAG_UC_PROMISC and ENETC_VF_FLAG_MC_PROMISC to
> enetc_vf_flags to track the PF-managed promiscuous mode state for each
> VF.
>
> - Update enetc_msg_set_vf_mac_promisc_mode() to keep these flags in sync
> whenever a VF requests a promiscuous mode change via messaging.
>
> - Update enetc_pf_set_vf_trust() to clear both promisc flags when a VF
> is untrusted, so that a subsequent FLR cannot restore promiscuous mode
> that the PF has already revoked.
>
> - Add a vf_flr_handler callback to enetc_pf_ops. The ENETC v4
> implementation re-applies the tracked UC/MC promiscuous mode settings
> to the hardware after each FLR, ensuring the hardware state matches
> the PF-managed policy rather than the insecure reset default.
>
> - Add enetc_vf_flr_handler() in enetc_msg.c to detect FLR events via the
> PSIIDR register and dispatch to the vf_flr_handler callback. Invoke it
> at the start of enetc_msg_task() before processing VF messages.
>
> - Enable FLR interrupts in PSIIER only when a vf_flr_handler callback is
> registered, keeping ENETC v1 behavior unchanged.
>
> Signed-off-by: Wei Fang <wei.fang@xxxxxxx>
Reviewed-by: Claudiu Manoil <claudiu.manoil@xxxxxxx>