Re: [PATCH net-next] net: Reoder rxq_idx check in __net_mp_open_rxq()
From: Mina Almasry
Date: Tue Jun 24 2025 - 11:38:17 EST
On Tue, Jun 24, 2025 at 6:44 AM Yue Haibing <yuehaibing@xxxxxxxxxx> wrote:
>
> 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 <yuehaibing@xxxxxxxxxx>
Fix looks valid to me. The current code looks wrong because the
dev->real_num_rx_queues check is done twice, so we'll never hit the
NL_SET_ERR_MSG.
One side effect of this is that userspace code that does an out of
range rxq bind will see EINVAL before this patch and it will see an
ERANGE with a netlink error message after this patch. I think this
change is fine even though it's a minor uapi change.
Reviewed-by: Mina Almasry <almasrymina@xxxxxxxxxx>
--
Thanks,
Mina