Skip to content

Commit 9407190

Browse files
gal-pressmankuba-moo
authored andcommitted
ethtool: Fix access to uninitialized fields in set RXNFC command
The check for non-zero ring with RSS is only relevant for ETHTOOL_SRXCLSRLINS command, in other cases the check tries to access memory which was not initialized by the userspace tool. Only perform the check in case of ETHTOOL_SRXCLSRLINS. Without this patch, filter deletion (for example) could statistically result in a false error: # ethtool --config-ntuple eth3 delete 484 rmgr: Cannot delete RX class rule: Invalid argument Cannot delete classification rule Fixes: 9e43ad7 ("net: ethtool: only allow set_rxnfc with rss + ring_cookie if driver opts in") Link: https://lore.kernel.org/netdev/[email protected]/ Reviewed-by: Dragos Tatulea <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Gal Pressman <[email protected]> Reviewed-by: Edward Cree <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3d501f5 commit 9407190

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ethtool/ioctl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,8 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
993993
return rc;
994994

995995
/* Nonzero ring with RSS only makes sense if NIC adds them together */
996-
if (info.flow_type & FLOW_RSS && !ops->cap_rss_rxnfc_adds &&
996+
if (cmd == ETHTOOL_SRXCLSRLINS && info.flow_type & FLOW_RSS &&
997+
!ops->cap_rss_rxnfc_adds &&
997998
ethtool_get_flow_spec_ring(info.fs.ring_cookie))
998999
return -EINVAL;
9991000

0 commit comments

Comments
 (0)