stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Jacob Keller <jacob.e.keller@intel.com>,
	Konrad Jankowski <konrad0.jankowski@intel.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10 17/71] ice: stop disabling VFs due to PF error responses
Date: Mon, 14 Mar 2022 12:53:10 +0100	[thread overview]
Message-ID: <20220314112738.415508406@linuxfoundation.org> (raw)
In-Reply-To: <20220314112737.929694832@linuxfoundation.org>

From: Jacob Keller <jacob.e.keller@intel.com>

[ Upstream commit 79498d5af8e458102242d1667cf44df1f1564e63 ]

The ice_vc_send_msg_to_vf function has logic to detect "failure"
responses being sent to a VF. If a VF is sent more than
ICE_DFLT_NUM_INVAL_MSGS_ALLOWED then the VF is marked as disabled.
Almost identical logic also existed in the i40e driver.

This logic was added to the ice driver in commit 1071a8358a28 ("ice:
Implement virtchnl commands for AVF support") which itself copied from
the i40e implementation in commit 5c3c48ac6bf5 ("i40e: implement virtual
device interface").

Neither commit provides a proper explanation or justification of the
check. In fact, later commits to i40e changed the logic to allow
bypassing the check in some specific instances.

The "logic" for this seems to be that error responses somehow indicate a
malicious VF. This is not really true. The PF might be sending an error
for any number of reasons such as lack of resources, etc.

Additionally, this causes the PF to log an info message for every failed
VF response which may confuse users, and can spam the kernel log.

This behavior is not documented as part of any requirement for our
products and other operating system drivers such as the FreeBSD
implementation of our drivers do not include this type of check.

In fact, the change from dev_err to dev_info in i40e commit 18b7af57d9c1
("i40e: Lower some message levels") explains that these messages
typically don't actually indicate a real issue. It is quite likely that
a user who hits this in practice will be very confused as the VF will be
disabled without an obvious way to recover.

We already have robust malicious driver detection logic using actual
hardware detection mechanisms that detect and prevent invalid device
usage. Remove the logic since its not a documented requirement and the
behavior is not intuitive.

Fixes: 1071a8358a28 ("ice: Implement virtchnl commands for AVF support")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 .../net/ethernet/intel/ice/ice_virtchnl_pf.c   | 18 ------------------
 .../net/ethernet/intel/ice/ice_virtchnl_pf.h   |  3 ---
 2 files changed, 21 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
index 48511ad0e0c8..5134342ff70f 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
@@ -1849,24 +1849,6 @@ ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode,
 
 	dev = ice_pf_to_dev(pf);
 
-	/* single place to detect unsuccessful return values */
-	if (v_retval) {
-		vf->num_inval_msgs++;
-		dev_info(dev, "VF %d failed opcode %d, retval: %d\n", vf->vf_id,
-			 v_opcode, v_retval);
-		if (vf->num_inval_msgs > ICE_DFLT_NUM_INVAL_MSGS_ALLOWED) {
-			dev_err(dev, "Number of invalid messages exceeded for VF %d\n",
-				vf->vf_id);
-			dev_err(dev, "Use PF Control I/F to enable the VF\n");
-			set_bit(ICE_VF_STATE_DIS, vf->vf_states);
-			return -EIO;
-		}
-	} else {
-		vf->num_valid_msgs++;
-		/* reset the invalid counter, if a valid message is received. */
-		vf->num_inval_msgs = 0;
-	}
-
 	aq_ret = ice_aq_send_msg_to_vf(&pf->hw, vf->vf_id, v_opcode, v_retval,
 				       msg, msglen, NULL);
 	if (aq_ret && pf->hw.mailboxq.sq_last_status != ICE_AQ_RC_ENOSYS) {
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h
index 59e5b4f16e96..d2e935c678a1 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h
@@ -13,7 +13,6 @@
 #define ICE_MAX_MACADDR_PER_VF		18
 
 /* Malicious Driver Detection */
-#define ICE_DFLT_NUM_INVAL_MSGS_ALLOWED		10
 #define ICE_MDD_EVENTS_THRESHOLD		30
 
 /* Static VF transaction/status register def */
@@ -97,8 +96,6 @@ struct ice_vf {
 	unsigned int tx_rate;		/* Tx bandwidth limit in Mbps */
 	DECLARE_BITMAP(vf_states, ICE_VF_STATES_NBITS);	/* VF runtime states */
 
-	u64 num_inval_msgs;		/* number of continuous invalid msgs */
-	u64 num_valid_msgs;		/* number of valid msgs detected */
 	unsigned long vf_caps;		/* VF's adv. capabilities */
 	u8 num_req_qs;			/* num of queue pairs requested by VF */
 	u16 num_mac;
-- 
2.34.1




  parent reply	other threads:[~2022-03-14 12:02 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 11:52 [PATCH 5.10 00/71] 5.10.106-rc1 review Greg Kroah-Hartman
2022-03-14 11:52 ` [PATCH 5.10 01/71] ARM: boot: dts: bcm2711: Fix HVS register range Greg Kroah-Hartman
2022-03-14 11:52 ` [PATCH 5.10 02/71] clk: qcom: gdsc: Add support to update GDSC transition delay Greg Kroah-Hartman
2022-03-14 11:52 ` [PATCH 5.10 03/71] HID: vivaldi: fix sysfs attributes leak Greg Kroah-Hartman
2022-03-14 11:52 ` [PATCH 5.10 04/71] arm64: dts: armada-3720-turris-mox: Add missing ethernet0 alias Greg Kroah-Hartman
2022-03-14 11:52 ` [PATCH 5.10 05/71] tipc: fix kernel panic when enabling bearer Greg Kroah-Hartman
2022-03-14 11:52 ` [PATCH 5.10 06/71] mISDN: Remove obsolete PIPELINE_DEBUG debugging information Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 07/71] mISDN: Fix memory leak in dsp_pipeline_build() Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 08/71] virtio-blk: Dont use MAX_DISCARD_SEGMENTS if max_discard_seg is zero Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 09/71] isdn: hfcpci: check the return value of dma_set_mask() in setup_hw() Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 10/71] net: qlogic: check the return value of dma_alloc_coherent() in qed_vf_hw_prepare() Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 11/71] esp: Fix BEET mode inter address family tunneling on GSO Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 12/71] qed: return status of qed_iov_get_link Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 13/71] drm/sun4i: mixer: Fix P010 and P210 format numbers Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 14/71] net: dsa: mt7530: fix incorrect test in mt753x_phylink_validate() Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 15/71] ARM: dts: aspeed: Fix AST2600 quad spi group Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 16/71] i40e: stop disabling VFs due to PF error responses Greg Kroah-Hartman
2022-03-14 11:53 ` Greg Kroah-Hartman [this message]
2022-03-14 11:53 ` [PATCH 5.10 18/71] ice: Align macro names to the specification Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 19/71] ice: Remove unnecessary checker loop Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 20/71] ice: Rename a couple of variables Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 21/71] ice: Fix curr_link_speed advertised speed Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 22/71] ethernet: Fix error handling in xemaclite_of_probe Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 23/71] tipc: fix incorrect order of state message data sanity check Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 24/71] net: ethernet: ti: cpts: Handle error for clk_enable Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 25/71] net: ethernet: lpc_eth: " Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 26/71] ax25: Fix NULL pointer dereference in ax25_kill_by_device Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 27/71] net/mlx5: Fix size field in bufferx_reg struct Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 28/71] net/mlx5: Fix a race on command flush flow Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 29/71] net/mlx5e: Lag, Only handle events from highest priority multipath entry Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 30/71] NFC: port100: fix use-after-free in port100_send_complete Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 31/71] selftests: pmtu.sh: Kill tcpdump processes launched by subshell Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 32/71] gpio: ts4900: Do not set DAT and OE together Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 33/71] gianfar: ethtool: Fix refcount leak in gfar_get_ts_info Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 34/71] net: phy: DP83822: clear MISR2 register to disable interrupts Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 35/71] sctp: fix kernel-infoleak for SCTP sockets Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 36/71] net: bcmgenet: Dont claim WOL when its not available Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 37/71] selftests/bpf: Add test for bpf_timer overwriting crash Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 38/71] spi: rockchip: Fix error in getting num-cs property Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 39/71] spi: rockchip: terminate dma transmission when slave abort Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 40/71] net-sysfs: add check for netdevice being present to speed_show Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 41/71] hwmon: (pmbus) Clear pmbus fault/warning bits after read Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 42/71] gpio: Return EPROBE_DEFER if gc->to_irq is NULL Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 43/71] Revert "xen-netback: remove hotplug-status once it has served its purpose" Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 44/71] Revert "xen-netback: Check for hotplug-status existence before watching" Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 45/71] ipv6: prevent a possible race condition with lifetimes Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 46/71] tracing: Ensure trace buffer is at least 4096 bytes large Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 47/71] selftest/vm: fix map_fixed_noreplace test failure Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 48/71] selftests/memfd: clean up mapping in mfd_fail_write Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 49/71] ARM: Spectre-BHB: provide empty stub for non-config Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 50/71] fuse: fix pipe buffer lifetime for direct_io Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 51/71] staging: rtl8723bs: Fix access-point mode deadlock Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 52/71] staging: gdm724x: fix use after free in gdm_lte_rx() Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 53/71] net: macb: Fix lost RX packet wakeup race in NAPI receive Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 54/71] mmc: meson: Fix usage of meson_mmc_post_req() Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 55/71] riscv: Fix auipc+jalr relocation range checks Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 56/71] arm64: dts: marvell: armada-37xx: Remap IO space to bus address 0x0 Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 57/71] virtio: unexport virtio_finalize_features Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 58/71] virtio: acknowledge all features before access Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 59/71] watch_queue, pipe: Free watchqueue state after clearing pipe ring Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 60/71] watch_queue: Fix to release page in ->release() Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 61/71] watch_queue: Fix to always request a pow-of-2 pipe ring size Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 62/71] watch_queue: Fix the alloc bitmap size to reflect notes allocated Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 63/71] watch_queue: Free the alloc bitmap when the watch_queue is torn down Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 64/71] watch_queue: Fix lack of barrier/sync/lock between post and read Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 65/71] watch_queue: Make comment about setting ->defunct more accurate Greg Kroah-Hartman
2022-03-14 11:53 ` [PATCH 5.10 66/71] x86/boot: Fix memremap of setup_indirect structures Greg Kroah-Hartman
2022-03-14 11:54 ` [PATCH 5.10 67/71] x86/boot: Add setup_indirect support in early_memremap_is_setup_data() Greg Kroah-Hartman
2022-03-14 11:54 ` [PATCH 5.10 68/71] x86/traps: Mark do_int3() NOKPROBE_SYMBOL Greg Kroah-Hartman
2022-03-14 11:54 ` [PATCH 5.10 69/71] ext4: add check to prevent attempting to resize an fs with sparse_super2 Greg Kroah-Hartman
2022-03-14 11:54 ` [PATCH 5.10 70/71] ARM: fix Thumb2 regression with Spectre BHB Greg Kroah-Hartman
2022-03-14 11:54 ` [PATCH 5.10 71/71] watch_queue: Fix filter limit check Greg Kroah-Hartman
2022-03-14 17:00 ` [PATCH 5.10 00/71] 5.10.106-rc1 review Pavel Machek
2022-03-14 17:33 ` Fox Chen
2022-03-14 22:19 ` Florian Fainelli
2022-03-15  0:53 ` Guenter Roeck
2022-03-15  1:00 ` Samuel Zou
2022-03-15  6:31 ` Naresh Kamboju
2022-03-15  7:20 ` Bagas Sanjaya
2022-03-15  9:04 ` Jon Hunter
2022-03-15 12:34 ` Sudip Mukherjee

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=20220314112738.415508406@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=jacob.e.keller@intel.com \
    --cc=konrad0.jankowski@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).