Skip to content

Commit de7f758

Browse files
committed
net: ethtool: prevent flow steering to RSS contexts which don't exist
Since commit 42dc431 ("ethtool: rss: prevent rss ctx deletion when in use") we prevent removal of RSS contexts pointed to by existing flow rules. Core should also prevent creation of rules which point to RSS context which don't exist in the first place. Reviewed-by: Joe Damato <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 34c84b3 commit de7f758

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

net/ethtool/ioctl.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -993,10 +993,14 @@ 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 (cmd == ETHTOOL_SRXCLSRLINS && info.fs.flow_type & FLOW_RSS &&
997-
!ops->cap_rss_rxnfc_adds &&
998-
ethtool_get_flow_spec_ring(info.fs.ring_cookie))
999-
return -EINVAL;
996+
if (cmd == ETHTOOL_SRXCLSRLINS && info.fs.flow_type & FLOW_RSS) {
997+
if (!ops->cap_rss_rxnfc_adds &&
998+
ethtool_get_flow_spec_ring(info.fs.ring_cookie))
999+
return -EINVAL;
1000+
1001+
if (!xa_load(&dev->ethtool->rss_ctx, info.rss_context))
1002+
return -EINVAL;
1003+
}
10001004

10011005
if (cmd == ETHTOOL_SRXFH && ops->get_rxfh) {
10021006
struct ethtool_rxfh_param rxfh = {};

0 commit comments

Comments
 (0)