Re: [PATCH net-next v6 4/7] enic: validate V2 VF configuration replies
From: netdev-bot+sashiko
Date: Sat Dec 05 2026 - 11:28:22 EST
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 3
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The ADD_DEL_MAC reply handler and the SET_PKT_FILTER reply
handler apply different recovery policies to the same kind of failure,…
- [Low] This patch adds ENIC_MBOX_PF_SET_ADMIN_MAC_NOTIF/ACK and struct
enic_mbox_pf_set_admin_mac_notif_msg, and enic_mbox_vf_malformed_msg()…
- [Low] enic_mbox_vf_set_pkt_filter() always includes
CMD_PFILTER_DIRECTED in `required`, so a directed=0 request that the…
- [Low] The new reply handlers enic_mbox_vf_handle_add_del_mac_reply()
and enic_mbox_vf_handle_set_pkt_filter_reply() name their length…
--
enic: validate V2 VF configuration replies
This adds the VF side of the V2 mailbox ADD_DEL_MAC and SET_PKT_FILTER
operations, along with the administrative MAC protocol definitions. Each
reply is checked for framing, echoed operations, result counts and applied
filter flags. A malformed reply, or one reporting that the VF is no longer
registered, forces a new VF registration.
> diff --git a/drivers/net/ethernet/cisco/enic/enic_mbox.c b/drivers/net/ethernet/cisco/enic/enic_mbox.c
> index 3579d2980a246..c042cd2769dd5 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_mbox.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_mbox.c
[ ... ]
> @@ -605,16 +680,166 @@ static void enic_mbox_vf_handle_reply(struct enic *enic, u8 reply_type,
[ ... ]
> +static void enic_mbox_vf_handle_add_del_mac_reply(struct enic *enic,
> + void *payload, u16 msg_len,
> + u64 msg_num)
> +{
[Severity: Low]
This isn't a bug, but the msg_len parameter here actually receives the
payload length. The same is true in
enic_mbox_vf_handle_set_pkt_filter_reply(). enic_mbox_vf_process_msg()
calls it like this:
enic_mbox_vf_handle_add_del_mac_reply(enic, payload,
payload_len, msg_num);
Elsewhere in this file, enic_mbox_pf_process_msg() and
enic_mbox_recv_handler() use msg_len for le16_to_cpu(hdr->msg_len), and
that value includes the header.
The bounds checks are correct for a payload length today. Could the
parameter be renamed to payload_len? That would make it less likely that
a later change checks the peer-supplied mac_addr[] size against the wrong
length.
> + struct enic_mbox_vf_add_del_mac_reply_msg *reply = payload;
> + enum enic_mbox_vf_reply_recovery recovery;
[ ... ]
> + if (msg_len < sizeof(*reply)) {
> + status = enic_mbox_vf_classify_reply(true, 0, &recovery);
> + } else {
> + ret_major = le16_to_cpu(reply->reply.ret_major);
> + ret_minor = le16_to_cpu(reply->reply.ret_minor);
> + status = enic_mbox_vf_classify_reply(false, ret_major,
> + &recovery);
> + }
> + if (status)
> + goto claim;
[Severity: Medium]
Should an errno-style ret_major be treated as indeterminate here, as it
is for packet filters?
If ret_major has bits outside ENIC_MBOX_ERR_MASK,
enic_mbox_vf_classify_reply() returns -EIO and leaves recovery at
ENIC_MBOX_VF_REPLY_OK. The goto then skips the per-entry checks, so the
caller gets a plain -EIO and no reconnect happens.
enic_mbox_vf_handle_set_pkt_filter_reply() handles the same condition by
forcing a reconnect:
if (status && (ret_major & ~ENIC_MBOX_ERR_MASK))
recovery = ENIC_MBOX_VF_REPLY_RECONNECT;
An errno-style MAC reply has no per-entry results either. The VF cannot
tell which of up to ENIC_MBOX_MAX_MAC_OPS entries the PF applied. The
commit message says:
A coherent top-level MAC-operation failure remains an ordinary error.
Reserve reconnect for malformed or indeterminate replies and explicit
registration loss.
Nothing on this path checks whether the top-level failure is coherent.
Later in the series, enic_vf_sync_mac_filters() reconnects in the caller
when a request that includes a delete fails with a request-wide -EIO.
enic_vf_station_addr_replace() in enic_main.c does not reconnect:
err = enic_mbox_vf_add_del_macs(enic, macs, num_macs);
if (err) {
if (READ_ONCE(enic->mbox_tx_poisoned))
enic_mbox_vf_link_state_set_running(enic, false);
return err;
}
Every request it sends is a DEL+ADD (or DEL+DEL+ADD) compound. Suppose a
PF applies part of one and then returns an errno-style ret_major. Could
the VF then believe the old station filter is still installed, with no
re-registration to correct it?
The final patch in the series says supported PFs reject whole requests
before applying any operations. The VF side doesn't enforce that.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204-b4-enic-sriov-v2-vf-receive-control-v6-0-ca38950bbe07%40cisco.com