Skip to contentSkip to conversation

ethtool: Fix set RXNFC command with symmetric RSS hash

PATCH Applied Gal Pressman 5 participants 5 messages Jan 26, 2025 – Jan 28, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethtool: Fix set RXNFC command with symmetric RSS hash

The sanity check that both source and destination are set when symmetric RSS hash is requested is only relevant for ETHTOOL_SRXFH (rx-flow-hash), it should not be performed on any other commands (e.g. ETHTOOL_SRXCLSRLINS/ETHTOOL_SRXCLSRLDEL).

This resolves accessing uninitialized 'info.data' field, and fixes false errors in rule insertion:

  # ethtool --config-ntuple eth2 flow-type ip4 dst-ip 255.255.255.255 action -1 loc 0
  rmgr: Cannot insert RX class rule: Invalid argument
  Cannot insert classification rule
Fixes 13e59344fb9d ("net: ethtool: add support for symmetric-xor RSS hash")
Cc Ahmed Zaki <[email protected]>
---
 net/ethtool/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ethtool/ioctl.c +1 -1
index 7bb94875a7ec..34bee42e1247 100644
@@ -998,7 +998,7 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
 	    ethtool_get_flow_spec_ring(info.fs.ring_cookie))
 		return -EINVAL;
 
-	if (ops->get_rxfh) {
+	if (cmd == ETHTOOL_SRXFH && ops->get_rxfh) {
 		struct ethtool_rxfh_param rxfh = {};
 
 		rc = ops->get_rxfh(dev, &rxfh);
Signature · 1 line
2.40.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 34 lines · Gal Pressman

The sanity check that both source and destination are set when symmetric RSS hash is requested is only relevant for ETHTOOL_SRXFH (rx-flow-hash), it should not be performed on any other commands (e.g. ETHTOOL_SRXCLSRLINS/ETHTOOL_SRXCLSRLDEL).

This resolves accessing uninitialized 'info.data' field, and fixes false errors in rule insertion:

  # ethtool --config-ntuple eth2 flow-type ip4 dst-ip 255.255.255.255 action -1 loc 0
  rmgr: Cannot insert RX class rule: Invalid argument
  Cannot insert classification rule
Fixes 13e59344fb9d ("net: ethtool: add support for symmetric-xor RSS hash")
Cc Ahmed Zaki <[email protected]>
---
 net/ethtool/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ethtool/ioctl.c +1 -1
index 7bb94875a7ec..34bee42e1247 100644
@@ -998,7 +998,7 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
 	    ethtool_get_flow_spec_ring(info.fs.ring_cookie))
 		return -EINVAL;
 
-	if (ops->get_rxfh) {
+	if (cmd == ETHTOOL_SRXFH && ops->get_rxfh) {
 		struct ethtool_rxfh_param rxfh = {};
 
 		rc = ops->get_rxfh(dev, &rxfh);
Signature · 1 line
2.40.1

Thanks for fixing

Reviewed-by on v1 1/1
#2 lore raw
In reply to Gal Pressman
Quoted 7 lines · Gal Pressman

The sanity check that both source and destination are set when symmetric RSS hash is requested is only relevant for ETHTOOL_SRXFH (rx-flow-hash), it should not be performed on any other commands (e.g. ETHTOOL_SRXCLSRLINS/ETHTOOL_SRXCLSRLDEL).

This resolves accessing uninitialized 'info.data' field, and fixes false errors in rule insertion:

Quoted 8 lines
  # ethtool --config-ntuple eth2 flow-type ip4 dst-ip 255.255.255.255 action -1 loc 0
  rmgr: Cannot insert RX class rule: Invalid argument
  Cannot insert classification rule
Fixes 13e59344fb9d ("net: ethtool: add support for symmetric-xor RSS hash")
Cc Ahmed Zaki <[email protected]>
Reviewed-by on v1 1/1
#3 lore raw
In reply to Gal Pressman
Quoted 11 lines · Gal Pressman

The sanity check that both source and destination are set when symmetric RSS hash is requested is only relevant for ETHTOOL_SRXFH (rx-flow-hash), it should not be performed on any other commands (e.g. ETHTOOL_SRXCLSRLINS/ETHTOOL_SRXCLSRLDEL).

This resolves accessing uninitialized 'info.data' field, and fixes false errors in rule insertion:

   # ethtool --config-ntuple eth2 flow-type ip4 dst-ip 255.255.255.255 action -1 loc 0
   rmgr: Cannot insert RX class rule: Invalid argument
   Cannot insert classification rule
Quoted 5 lines
Fixes 13e59344fb9d ("net: ethtool: add support for symmetric-xor RSS hash")
Cc Ahmed Zaki <[email protected]>

---

Thanks for fixing this.

#4 lore raw
In reply to Gal Pressman
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:

Quoted 5 lines · On Sun, 26 Jan 2025 21:18:45 +0200 you wrote:

The sanity check that both source and destination are set when symmetric RSS hash is requested is only relevant for ETHTOOL_SRXFH (rx-flow-hash), it should not be performed on any other commands (e.g. ETHTOOL_SRXCLSRLINS/ETHTOOL_SRXCLSRLDEL).

Quoted 7 lines

This resolves accessing uninitialized 'info.data' field, and fixes false errors in rule insertion:

  # ethtool --config-ntuple eth2 flow-type ip4 dst-ip 255.255.255.255 action -1 loc 0
  rmgr: Cannot insert RX class rule: Invalid argument
  Cannot insert classification rule

[...]

Here is the summary with links:
- [net] ethtool: Fix set RXNFC command with symmetric RSS hash

    https://git.kernel.org/netdev/net/c/4f5a52adeb1a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html