net: make sure we never create ifindex = 0
authorJakub Kicinski <kuba@kernel.org>
Mon, 31 Jul 2023 17:11:58 +0000 (10:11 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 1 Aug 2023 22:01:29 +0000 (15:01 -0700)
commitceaac91dcd065db781d1ed5dfaef0686b8ec44dc
tree4eaf30a87763ea3be8b9ccf7b0d828806bc0c18e
parent005c9600003eabcb22336f37e149eed08f0a946a
net: make sure we never create ifindex = 0

Instead of allocating from 1 use proper xa_init flag,
to protect ourselves from IDs wrapping back to 0.

Fixes: 759ab1edb56c ("net: store netdevs in an xarray")
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Link: https://lore.kernel.org/all/20230728162350.2a6d4979@hermes.local/
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20230731171159.988962-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/dev.c