Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: satishkh@cisco.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	willemb@google.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, sebaddel@cisco.com,
	aradhana@cisco.com, rfaucett@cisco.com, sdf@fomichev.me
Subject: Re: [PATCH net-next v6 4/7] enic: validate V2 VF configuration replies
Date: Sat, 05 Dec 2026 16:28:15 +0000	[thread overview]
Message-ID: <179648809576.3146.12133041257712035106@kernel.org> (raw)
In-Reply-To: <20261204-b4-enic-sriov-v2-vf-receive-control-v6-4-ca38950bbe07@cisco.com>

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

  reply	other threads:[~2026-12-05 16:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 15:29 [PATCH net-next v6 0/7] enic: add V2 VF receive control over MBOX Satish Kharat
2026-12-04 15:29 ` [PATCH net-next v6 1/7] net: add netif_rx_mode_schedule_update() Satish Kharat
2026-12-04 15:29 ` [PATCH net-next v6 2/7] enic: serialize V2 VF mailbox requests Satish Kharat
2026-12-04 15:29 ` [PATCH net-next v6 3/7] enic: recover V2 VF mailbox after request failure Satish Kharat
2026-12-05 16:28   ` netdev-bot+sashiko
2026-12-04 15:29 ` [PATCH net-next v6 4/7] enic: validate V2 VF configuration replies Satish Kharat
2026-12-05 16:28   ` netdev-bot+sashiko [this message]
2026-12-04 15:29 ` [PATCH net-next v6 5/7] net: add dev_addr_set_sync() for driver address updates Satish Kharat
2026-12-05 16:28   ` netdev-bot+sashiko
2026-12-04 15:29 ` [PATCH net-next v6 6/7] enic: manage V2 VF station and administrative MAC Satish Kharat
2026-12-05 16:28   ` netdev-bot+sashiko
2026-12-04 15:29 ` [PATCH net-next v6 7/7] enic: configure V2 VF receive mode over mailbox Satish Kharat
2026-12-05 16:28   ` netdev-bot+sashiko

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=179648809576.3146.12133041257712035106@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=aradhana@cisco.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rfaucett@cisco.com \
    --cc=satishkh@cisco.com \
    --cc=sdf@fomichev.me \
    --cc=sebaddel@cisco.com \
    --cc=willemb@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox