kernel-hacking-2024-linux-s.../net/core
Ido Schimmel b20b8aec6f devlink: Fix netdev notifier chain corruption
Cited commit changed devlink to register its netdev notifier block on
the global netdev notifier chain instead of on the per network namespace
one.

However, when changing the network namespace of the devlink instance,
devlink still tries to unregister its notifier block from the chain of
the old namespace and register it on the chain of the new namespace.
This results in corruption of the notifier chains, as the same notifier
block is registered on two different chains: The global one and the per
network namespace one. In turn, this causes other problems such as the
inability to dismantle namespaces due to netdev reference count issues.

Fix by preventing devlink from moving its notifier block between
namespaces.

Reproducer:

 # echo "10 1" > /sys/bus/netdevsim/new_device
 # ip netns add test123
 # devlink dev reload netdevsim/netdevsim10 netns test123
 # ip netns del test123
 [   71.935619] unregister_netdevice: waiting for lo to become free. Usage count = 2
 [   71.938348] leaked reference.

Fixes: 565b4824c3 ("devlink: change port event netdev notifier from per-net to global")
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20230215073139.1360108-1-idosch@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-02-16 11:53:47 +01:00
..
bpf_sk_storage.c bpf: Fix a compilation failure with clang lto build 2022-11-30 17:13:25 -08:00
datagram.c
dev.c devlink: Fix netdev notifier chain corruption 2023-02-16 11:53:47 +01:00
dev.h
dev_addr_lists.c
dev_addr_lists_test.c
dev_ioctl.c
devlink.c devlink: Fix netdev notifier chain corruption 2023-02-16 11:53:47 +01:00
drop_monitor.c
dst.c Networking changes for 6.2. 2022-12-13 15:47:48 -08:00
dst_cache.c
failover.c net: failover: use IFF_NO_ADDRCONF flag to prevent ipv6 addrconf 2022-12-12 15:18:25 -08:00
fib_notifier.c
fib_rules.c
filter.c bpf: pull before calling skb_postpull_rcsum() 2022-12-20 15:58:35 -08:00
flow_dissector.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-11-29 13:04:52 -08:00
flow_offload.c
gen_estimator.c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
gen_stats.c
gro.c skb: Do mix page pool and page referenced frags in GRO 2023-01-27 23:21:27 -08:00
gro_cells.c
hwbm.c
link_watch.c
lwt_bpf.c
lwtunnel.c
Makefile
neighbour.c neigh: make sure used and confirmed times are valid 2023-02-06 08:44:31 +00:00
net-procfs.c
net-sysfs.c Driver Core changes for 6.2-rc1 2022-12-16 03:54:54 -08:00
net-sysfs.h
net-traces.c
net_namespace.c net: initialize net->notrefcnt_tracker earlier 2023-02-09 22:49:25 -08:00
netclassid_cgroup.c
netevent.c
netpoll.c
netprio_cgroup.c
of_net.c of: net: export of_get_mac_address_nvmem() 2022-11-29 10:45:53 +01:00
page_pool.c
pktgen.c
ptp_classifier.c
request_sock.c
rtnetlink.c
scm.c
secure_seq.c
selftests.c
skbuff.c net: fix NULL pointer in skb_segment_list 2023-01-31 21:07:04 -08:00
skmsg.c bpf, sockmap: Fix missing BPF_F_INGRESS flag when using apply_bytes 2022-12-01 01:07:32 +01:00
sock.c txhash: fix sk->sk_txrehash default 2023-02-08 09:07:11 +00:00
sock_destructor.h
sock_diag.c net: fix __sock_gen_cookie() 2022-11-21 20:36:30 -08:00
sock_map.c bpf, sockmap: Don't let sock_map_{close,destroy,unhash} call itself 2023-01-24 21:32:55 -08:00
sock_reuseport.c
stream.c net: Remove WARN_ON_ONCE(sk->sk_forward_alloc) from sk_stream_kill_queues(). 2023-02-10 19:53:42 -08:00
sysctl_net_core.c
timestamping.c
tso.c net: tso: inline tso_count_descs() 2022-12-12 15:04:39 -08:00
utils.c
xdp.c