aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/netdev_rx_queue.c
diff options
context:
space:
mode:
authorYue Haibing <[email protected]>2025-06-24 14:01:59 +0000
committerJakub Kicinski <[email protected]>2025-06-25 23:53:51 +0000
commitf6fa45d67e0546c114063c8b0acff48a0924738d (patch)
tree93c32eee787018c21180cdbfc3e6fdf523509af3 /net/core/netdev_rx_queue.c
parentnet: Remove unnecessary NULL check for lwtunnel_fill_encap() (diff)
downloadkernel-f6fa45d67e0546c114063c8b0acff48a0924738d.tar.gz
kernel-f6fa45d67e0546c114063c8b0acff48a0924738d.zip
net: Reoder rxq_idx check in __net_mp_open_rxq()
array_index_nospec() clamp the rxq_idx within the range of [0, dev->real_num_rx_queues), move the check before it. Signed-off-by: Yue Haibing <[email protected]> Reviewed-by: Mina Almasry <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/core/netdev_rx_queue.c')
-rw-r--r--net/core/netdev_rx_queue.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/core/netdev_rx_queue.c b/net/core/netdev_rx_queue.c
index d126f10197bf..3bf1151d8061 100644
--- a/net/core/netdev_rx_queue.c
+++ b/net/core/netdev_rx_queue.c
@@ -97,14 +97,12 @@ int __net_mp_open_rxq(struct net_device *dev, unsigned int rxq_idx,
if (!netdev_need_ops_lock(dev))
return -EOPNOTSUPP;
- if (rxq_idx >= dev->real_num_rx_queues)
- return -EINVAL;
- rxq_idx = array_index_nospec(rxq_idx, dev->real_num_rx_queues);
-
if (rxq_idx >= dev->real_num_rx_queues) {
NL_SET_ERR_MSG(extack, "rx queue index out of range");
return -ERANGE;
}
+ rxq_idx = array_index_nospec(rxq_idx, dev->real_num_rx_queues);
+
if (dev->cfg->hds_config != ETHTOOL_TCP_DATA_SPLIT_ENABLED) {
NL_SET_ERR_MSG(extack, "tcp-data-split is disabled");
return -EINVAL;