net: make sure we never create ifindex = 0
Subsystems (2)
Jakub Kicinski
maintainerPATCH v2 1/1 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 <[email protected]>
Signed-off-by Jakub Kicinski <[email protected]>
---
CC: [email protected]
--- net/core/dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/core/dev.c +1 -2
@@ -11271,8 +11271,7 @@ static int __net_init netdev_init(struct net *net)if (net->dev_index_head ==NULL ) goto err_idx; - net->ifindex =1 ; -xa_init_flags (&net->dev_by_index,XA_FLAGS_ALLOC ); +xa_init_flags (&net->dev_by_index,XA_FLAGS_ALLOC1 );RAW_INIT_NOTIFIER_HEAD (&net->netdev_chain);
Signature · 1 line
2.41.0
Quoted 7 lines · Jakub Kicinski
Instead of allocating from 1 use proper
xa_initflag, to protect ourselves from IDs wrapping back to 0.Fixes 759ab1edb56c ("net: store netdevs in an xarray")Reported-by Stephen Hemminger <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>
Quoted 6 lines
---
CC: [email protected]--- net/core/dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Thanks,
Reviewed-by Leon Romanovsky <[email protected]>
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Mon, 31 Jul 2023 10:11:58 -0700 you wrote:
Instead of allocating from 1 use proper
xa_initflag, to protect ourselves from IDs wrapping back to 0.Fixes 759ab1edb56c ("net: store netdevs in an xarray")Reported-by Stephen Hemminger <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>[...]
Here is the summary with links:
- [net-next,v2] net: make sure we never create ifindex = 0
https://git.kernel.org/netdev/net-next/c/ceaac91dcd06
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html