igb: do not let a VF set other VMOLR bits through its frame size
igb_set_vf_rlpml() gets the maximum frame size from the VF's
E1000_VF_SET_LPE mailbox message and takes it as a signed int. A value
with bit 31 set is negative, so it passes the "size >
MAX_JUMBO_FRAME_SIZE" clamp, and it is then ORed into the VF pool's
VMOLR without masking. Its upper bits set other bits of that register,
such as AUPE and ROPE.
A VF whose port VLAN was set by the PF has AUPE cleared, so that it only
receives frames tagged with that VLAN. Through this message it can set
AUPE again and receive untagged frames. It can also set ROPE, so that its
pool accepts unicast frames that match the Unicast Table Array; while the
PF fills that table, in promiscuous mode or when it has more unicast
addresses than receive address registers, that is all unicast traffic.
igb_set_vf_promisc() does not offer this to VFs.
Take the size as u32, so that such values are clamped to
MAX_JUMBO_FRAME_SIZE, which fits in the RLPML field.
Tested on an I350 with two VFs and kernel 7.3.1. VF 0 got port VLAN 100,
and a test build of igbvf sent its frame size with bits 31, 26 and 24
set. Before this patch, AUPE, ROPE and STRCRC were then set in that VF
pool's VMOLR (0x8f010bce); with it they stay clear, and the size is
clamped to 9728. The normal igbvf still sets its size (3022 at VF MTU
3000) as before.
This was found by the Sashiko AI review of another igb patch.
Link: https://lore.kernel.org/all/179370458190.488856.17697539789438631896@kernel.org/
Fixes: 4ae196dfd61d ("igb: Add support for enabling VFs to PF driver.")
Cc: stable@vger.kernel.org
Signed-off-by: Tjerk Kusters <tkusters@aweta.nl>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
1 file changed