This is a note to let you know that I've just added the patch titled net: make sure we never create ifindex = 0 to the 6.5-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-make-sure-we-never-create-ifindex-0.patch and it can be found in the queue-6.5 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From ceaac91dcd065db781d1ed5dfaef0686b8ec44dc Mon Sep 17 00:00:00 2001 From: Jakub Kicinski <kuba@xxxxxxxxxx> Date: Mon, 31 Jul 2023 10:11:58 -0700 Subject: net: make sure we never create ifindex = 0 From: Jakub Kicinski <kuba@xxxxxxxxxx> commit ceaac91dcd065db781d1ed5dfaef0686b8ec44dc upstream. 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@xxxxxxxxxxxxxxxxxx> Link: https://lore.kernel.org/all/20230728162350.2a6d4979@hermes.local/ Reviewed-by: Leon Romanovsky <leonro@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230731171159.988962-1-kuba@xxxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/core/dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -11253,8 +11253,7 @@ static int __net_init netdev_init(struct 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); Patches currently in stable-queue which might be from kuba@xxxxxxxxxx are queue-6.5/net-make-sure-we-never-create-ifindex-0.patch queue-6.5/tcp_bpf-properly-release-resources-on-error-paths.patch queue-6.5/net-fix-ifname-in-netlink-ntf-during-netns-move.patch queue-6.5/docs-fix-info-about-representor-identification.patch queue-6.5/net-sched-sch_hfsc-upgrade-rt-to-sc-when-it-becomes-a-inner-curve.patch queue-6.5/ipv4-fib-annotate-races-around-nh-nh_saddr_genid-and-nh-nh_saddr.patch queue-6.5/ice-reset-first-in-crash-dump-kernels.patch queue-6.5/net-phy-bcm7xxx-add-missing-16nm-ephy-statistics.patch queue-6.5/tcp-check-mptcp-level-constraints-for-backlog-coalescing.patch queue-6.5/sky2-make-sure-there-is-at-least-one-frag_addr-avail.patch queue-6.5/net-smc-return-the-right-falback-reason-when-prefix-checks-fail.patch queue-6.5/net-move-altnames-together-with-the-netdevice.patch queue-6.5/ice-fix-safe-mode-when-ddp-is-missing.patch queue-6.5/tcp-fix-excessive-tlp-and-rack-timeouts-from-hz-rounding.patch queue-6.5/net-usb-smsc95xx-fix-an-error-code-in-smsc95xx_reset.patch queue-6.5/octeon_ep-update-bql-sent-bytes-before-ringing-doorbell.patch queue-6.5/net-check-for-altname-conflicts-when-changing-netdev-s-netns.patch queue-6.5/selftests-mptcp-join-no-rst-when-rm-subflow-addr.patch queue-6.5/net-store-netdevs-in-an-xarray.patch queue-6.5/tcp-fix-listen-warning-with-v4-mapped-v6-address.patch queue-6.5/mptcp-more-conservative-check-for-zero-probes.patch queue-6.5/net-mdio-mux-fix-c45-access-returning-eio-after-api-change.patch queue-6.5/net-tls-split-tls_rx_reader_lock.patch queue-6.5/ice-fix-over-shifted-variable.patch queue-6.5/net-avoid-uaf-on-deleted-altname.patch queue-6.5/net-dsa-bcm_sf2-fix-possible-memory-leak-in-bcm_sf2_mdio_register.patch queue-6.5/tcp-tsq-relax-tcp_small_queue_check-when-rtx-queue-contains-a-single-skb.patch queue-6.5/tcp-allow-again-tcp_disconnect-when-threads-are-wait.patch queue-6.5/netlink-correct-offload_xstats-size.patch queue-6.5/tun-prevent-negative-ifindex.patch queue-6.5/net-smc-fix-smc-clc-failed-issue-when-netdevice-not-.patch queue-6.5/i40e-prevent-crash-on-probe-if-hw-registers-have-invalid-values.patch queue-6.5/nfc-nci-fix-possible-null-pointer-dereference-in-send_acknowledge.patch