diff options
| author | Breno Leitao <leitao@debian.org> | 2025-09-17 02:58:08 -0700 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2025-09-18 07:07:36 -0700 |
| commit | 3efaede2e13b0c0372500a6acdfc5c31268a3ed4 (patch) | |
| tree | 69591c7c8e4593f959befc533fb2b162b82bade3 | |
| parent | 672beab06656f2f1bda4708cda2b9af61c58a7ea (diff) | |
net: ethtool: pass the num of RX rings directly to ethtool_copy_validate_indir
Modify ethtool_copy_validate_indir() and callers to validate indirection
table entries against the number of RX rings as an integer instead of
accessing rx_rings->data.
This will be useful in the future, given that struct ethtool_rxnfc might
not exist for native GRXRINGS call.
Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20250917-gxrings-v4-1-dae520e2e1cb@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
| -rw-r--r-- | net/ethtool/ioctl.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 0b2a4d0573b3..15627afa4424 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -1246,8 +1246,8 @@ err_out: } static int ethtool_copy_validate_indir(u32 *indir, void __user *useraddr, - struct ethtool_rxnfc *rx_rings, - u32 size) + int num_rx_rings, + u32 size) { int i; @@ -1256,7 +1256,7 @@ static int ethtool_copy_validate_indir(u32 *indir, void __user *useraddr, /* Validate ring indices */ for (i = 0; i < size; i++) - if (indir[i] >= rx_rings->data) + if (indir[i] >= num_rx_rings) return -EINVAL; return 0; @@ -1366,7 +1366,7 @@ static noinline_for_stack int ethtool_set_rxfh_indir(struct net_device *dev, } else { ret = ethtool_copy_validate_indir(rxfh_dev.indir, useraddr + ringidx_offset, - &rx_rings, + rx_rings.data, rxfh_dev.indir_size); if (ret) goto out; @@ -1587,7 +1587,7 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev, rxfh_dev.indir_size = dev_indir_size; ret = ethtool_copy_validate_indir(rxfh_dev.indir, useraddr + rss_cfg_offset, - &rx_rings, + rx_rings.data, rxfh.indir_size); if (ret) goto out_free; |