public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH net] ethtool: Fix set RXNFC command with symmetric RSS hash
@ 2025-01-26 19:18 Gal Pressman
  2025-01-27  6:18 ` Michal Swiatkowski
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Gal Pressman @ 2025-01-26 19:18 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: Simon Horman, Edward Cree, netdev, Eric Dumazet, Paolo Abeni,
	Gal Pressman, Ahmed Zaki, Tariq Toukan

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 <ahmed.zaki@intel•com>
Reviewed-by: Tariq Toukan <tariqt@nvidia•com>
Signed-off-by: Gal Pressman <gal@nvidia•com>
---
 net/ethtool/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 7bb94875a7ec..34bee42e1247 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -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);
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] ethtool: Fix set RXNFC command with symmetric RSS hash
  2025-01-26 19:18 [PATCH net] ethtool: Fix set RXNFC command with symmetric RSS hash Gal Pressman
@ 2025-01-27  6:18 ` Michal Swiatkowski
  2025-01-27 14:14 ` Edward Cree
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Swiatkowski @ 2025-01-27  6:18 UTC (permalink / raw)
  To: Gal Pressman
  Cc: David S. Miller, Jakub Kicinski, Simon Horman, Edward Cree,
	netdev, Eric Dumazet, Paolo Abeni, Ahmed Zaki, Tariq Toukan

On Sun, Jan 26, 2025 at 09:18:45PM +0200, Gal Pressman 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).
> 
> 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 <ahmed.zaki@intel•com>
> Reviewed-by: Tariq Toukan <tariqt@nvidia•com>
> Signed-off-by: Gal Pressman <gal@nvidia•com>
> ---
>  net/ethtool/ioctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
> index 7bb94875a7ec..34bee42e1247 100644
> --- a/net/ethtool/ioctl.c
> +++ b/net/ethtool/ioctl.c
> @@ -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);
> -- 
> 2.40.1

Thanks for fixing
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux•intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] ethtool: Fix set RXNFC command with symmetric RSS hash
  2025-01-26 19:18 [PATCH net] ethtool: Fix set RXNFC command with symmetric RSS hash Gal Pressman
  2025-01-27  6:18 ` Michal Swiatkowski
@ 2025-01-27 14:14 ` Edward Cree
  2025-01-27 15:01 ` Ahmed Zaki
  2025-01-28 11:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Edward Cree @ 2025-01-27 14:14 UTC (permalink / raw)
  To: Gal Pressman, David S. Miller, Jakub Kicinski
  Cc: Simon Horman, netdev, Eric Dumazet, Paolo Abeni, Ahmed Zaki,
	Tariq Toukan

On 26/01/2025 19:18, Gal Pressman 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).
> 
> 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 <ahmed.zaki@intel•com>
> Reviewed-by: Tariq Toukan <tariqt@nvidia•com>
> Signed-off-by: Gal Pressman <gal@nvidia•com>

Reviewed-by: Edward Cree <ecree.xilinx@gmail•com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] ethtool: Fix set RXNFC command with symmetric RSS hash
  2025-01-26 19:18 [PATCH net] ethtool: Fix set RXNFC command with symmetric RSS hash Gal Pressman
  2025-01-27  6:18 ` Michal Swiatkowski
  2025-01-27 14:14 ` Edward Cree
@ 2025-01-27 15:01 ` Ahmed Zaki
  2025-01-28 11:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Ahmed Zaki @ 2025-01-27 15:01 UTC (permalink / raw)
  To: Gal Pressman, David S. Miller, Jakub Kicinski
  Cc: Simon Horman, Edward Cree, netdev, Eric Dumazet, Paolo Abeni,
	Tariq Toukan



On 2025-01-26 12:18 p.m., Gal Pressman 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).
> 
> 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 <ahmed.zaki@intel•com>
> Reviewed-by: Tariq Toukan <tariqt@nvidia•com>
> Signed-off-by: Gal Pressman <gal@nvidia•com>
> ---

Thanks for fixing this.

Reviewed-by: Ahmed Zaki <ahmed.zaki@intel•com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] ethtool: Fix set RXNFC command with symmetric RSS hash
  2025-01-26 19:18 [PATCH net] ethtool: Fix set RXNFC command with symmetric RSS hash Gal Pressman
                   ` (2 preceding siblings ...)
  2025-01-27 15:01 ` Ahmed Zaki
@ 2025-01-28 11:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-01-28 11:40 UTC (permalink / raw)
  To: Gal Pressman
  Cc: davem, kuba, horms, ecree.xilinx, netdev, edumazet, pabeni,
	ahmed.zaki, tariqt

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat•com>:

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).
> 
> 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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-01-28 11:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-26 19:18 [PATCH net] ethtool: Fix set RXNFC command with symmetric RSS hash Gal Pressman
2025-01-27  6:18 ` Michal Swiatkowski
2025-01-27 14:14 ` Edward Cree
2025-01-27 15:01 ` Ahmed Zaki
2025-01-28 11:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox