From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796488097; b=tGE+DYuqEABgG1eN3aOZtjgoDkI1dMear1MIxeh20Ad3ZbUtT7AzYtAAQ/d17ZNXVbHs RmEyoElhGzGqyXyCHUauTjMYJ5qoCEz+m5iyuRDHaKwwhMVJcuP6ooX9Y7J5ZByhDgAUx VWge1oi1AWoYF6QPdd+2dSlsQnhosUDK5RFqNqyGV23yLikCHzxTSSuJB5YY7clC+NDcB R6oFawu739Za1ESd3Le1sXZO/m6qgsCgXM7AUMY/3cwnwwRiJ0sA1YjbhQyZRhf4yuL2z qHiS+wXPuKSe5gLRCCpVUr6r8Owo829D9fmVFooVSR1/L0q2DJQVgdHdS+EIoMtEq9A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796488097; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=LCYhAgUR4xXe3nKHA3nCiaTYxn2qt6rL15uzyRK2dGE=; b=kZdnHDPzJQyNamFBTy60nKCCEtuRLrvNemOnue1fF8nrv/q4RwdbBtq9N6+pBJeLGl4a bkXvV3ou1vXf28pKCl1GOJfax2vwM32yM/whZKwS+UHkXk5u3Ph7J9Cb57COf4sx78eyI ViTD8/b8q2eFsivKpfSsQCAEbTyPuiZErU9aPeFmND5f6EHdYkDafiU7vtdzIXNHAdupJ 82x3N8eKmD3/Xy7oJU6LUuneUTz4px0Hpgqd6KwAq4vQM0OHADI2J+1oVNBOw4dmTbrBs wFiPcSw1wYssj+2RHxj1Wn0AS4QYR76mUdBdvnuk6rvkemo4Yr4fQ+vrTvzY7pCTKwQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=THy3QVlO; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59231606A330; Sat, 5 Dec 2026 16:28:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=THy3QVlO Received: by smtp.kernel.org (Postfix) with ESMTPSA id 336F31F0092B; Sat, 5 Dec 2026 16:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796488096; bh=LCYhAgUR4xXe3nKHA3nCiaTYxn2qt6rL15uzyRK2dGE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=THy3QVlOgjQ9mcUqGs1Rol8oaDZOm1zn+KfMvpd+bsqGY5MTuRs196te4owpAnz0O H2gqUa9554yzmwuchZI+InLm3/vHKkjE0PA5Ke+wMLT3+faPG+ejCL6aVk5Bh3Ndtk 82kJdUJtP06R87ANlNDEU4bhU8bT1I51e2RcZRWdpgqNmXDM0fRMUjo4mzBgFJhx5h lqyGBR1vttJRG6sNqTgZwmWS0grLf2KmXMSOudVwGhUDowe6WT/0F84zteJkQxIuly YOciFjYncWoWRUjXb+BkHBTOKoeXBoGtNFtgknxoRLz3iPuC+Ox3SjiheyqqD4Hmno 7hRc9kven+mcg== Subject: Re: [PATCH net-next v6 4/7] enic: validate V2 VF configuration replies 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 Date: Sat, 05 Dec 2026 16:28:15 +0000 Message-ID: <179648809576.3146.12133041257712035106@kernel.org> In-Reply-To: <20261204-b4-enic-sriov-v2-vf-receive-control-v6-4-ca38950bbe07@cisco.com> References: <20261204-b4-enic-sriov-v2-vf-receive-control-v6-4-ca38950bbe07@cisco.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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