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.1-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.1 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 @@ -11238,8 +11238,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.1/net-make-sure-we-never-create-ifindex-0.patch queue-6.1/net-dst-prevent-false-sharing-vs.-dst_entry-__refcnt.patch queue-6.1/tcp_bpf-properly-release-resources-on-error-paths.patch queue-6.1/net-fix-ifname-in-netlink-ntf-during-netns-move.patch queue-6.1/net-devlink-convert-devlink-port-type-specific-point.patch queue-6.1/net-sched-sch_hfsc-upgrade-rt-to-sc-when-it-becomes-a-inner-curve.patch queue-6.1/ipv4-fib-annotate-races-around-nh-nh_saddr_genid-and-nh-nh_saddr.patch queue-6.1/ice-reset-first-in-crash-dump-kernels.patch queue-6.1/net-use-call_rcu_hurry-for-dst_release.patch queue-6.1/net-devlink-track-netdev-with-devlink_port-assigned.patch queue-6.1/net-devlink-move-port_type_netdev_checks-call-to-__d.patch queue-6.1/net-phy-bcm7xxx-add-missing-16nm-ephy-statistics.patch queue-6.1/tcp-check-mptcp-level-constraints-for-backlog-coalescing.patch queue-6.1/sky2-make-sure-there-is-at-least-one-frag_addr-avail.patch queue-6.1/net-smc-return-the-right-falback-reason-when-prefix-checks-fail.patch queue-6.1/net-move-altnames-together-with-the-netdevice.patch queue-6.1/tcp-fix-excessive-tlp-and-rack-timeouts-from-hz-rounding.patch queue-6.1/net-usb-smsc95xx-fix-an-error-code-in-smsc95xx_reset.patch queue-6.1/octeon_ep-update-bql-sent-bytes-before-ringing-doorbell.patch queue-6.1/net-check-for-altname-conflicts-when-changing-netdev-s-netns.patch queue-6.1/net-store-netdevs-in-an-xarray.patch queue-6.1/tcp-fix-listen-warning-with-v4-mapped-v6-address.patch queue-6.1/mptcp-more-conservative-check-for-zero-probes.patch queue-6.1/net-devlink-move-port_type_warn_schedule-call-to-__d.patch queue-6.1/net-tls-split-tls_rx_reader_lock.patch queue-6.1/ice-fix-over-shifted-variable.patch queue-6.1/net-avoid-uaf-on-deleted-altname.patch queue-6.1/net-dsa-bcm_sf2-fix-possible-memory-leak-in-bcm_sf2_mdio_register.patch queue-6.1/net-dst-switch-to-rcuref_t-reference-counting.patch queue-6.1/tcp-tsq-relax-tcp_small_queue_check-when-rtx-queue-contains-a-single-skb.patch queue-6.1/tcp-allow-again-tcp_disconnect-when-threads-are-wait.patch queue-6.1/netlink-correct-offload_xstats-size.patch queue-6.1/net-dst-fix-missing-initialization-of-rt_uncached.patch queue-6.1/net-devlink-take-rtnl-in-port_fill-function-only-if-.patch queue-6.1/tun-prevent-negative-ifindex.patch queue-6.1/net-smc-fix-smc-clc-failed-issue-when-netdevice-not-.patch queue-6.1/i40e-prevent-crash-on-probe-if-hw-registers-have-invalid-values.patch queue-6.1/nfc-nci-fix-possible-null-pointer-dereference-in-send_acknowledge.patch