linux-stable/include
Eric Dumazet c88644ab5b net: initialize init_net earlier
[ Upstream commit 9c1be1935f ]

While testing a patch that will follow later
("net: add netns refcount tracker to struct nsproxy")
I found that devtmpfs_init() was called before init_net
was initialized.

This is a bug, because devtmpfs_setup() calls
ksys_unshare(CLONE_NEWNS);

This has the effect of increasing init_net refcount,
which will be later overwritten to 1, as part of setup_net(&init_net)

We had too many prior patches [1] trying to work around the root cause.

Really, make sure init_net is in BSS section, and that net_ns_init()
is called earlier at boot time.

Note that another patch ("vfs: add netns refcount tracker
to struct fs_context") also will need net_ns_init() being called
before vfs_caches_init()

As a bonus, this patch saves around 4KB in .data section.

[1]

f8c46cb390 ("netns: do not call pernet ops for not yet set up init_net namespace")
b5082df801 ("net: Initialise init_net.count to 1")
734b65417b ("net: Statically initialize init_net.dev_base_head")

v2: fixed a build error reported by kernel build bots (CONFIG_NET=n)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-13 19:27:12 +02:00
..
acpi
asm-generic bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
clocksource
crypto lib/crypto: blake2s: avoid indirect calls to compression function for Clang CFI 2022-02-04 19:22:32 +01:00
drm drm/connector: Fix typo in documentation 2022-04-08 13:58:58 +02:00
dt-bindings Fixes for omaps 2022-02-07 17:42:44 +01:00
keys
kunit
kvm
linux ref_tracker: implement use-after-free detection 2022-04-13 19:27:12 +02:00
math-emu
media
memory
misc
net net: initialize init_net earlier 2022-04-13 19:27:12 +02:00
pcmcia
ras
rdma
scsi scsi: core: sd: Add silence_suspend flag to suppress some PM messages 2022-04-08 13:57:20 +02:00
soc soc: fsl: Replace kernel.h with the necessary inclusions 2022-02-18 17:11:17 -06:00
sound ALSA: intel-nhlt: add helper to detect SSP link mask 2022-04-08 13:58:46 +02:00
target
trace rxrpc: Fix call timer start racing with call destruction 2022-04-08 13:58:55 +02:00
uapi bpf: Make dst_port field in struct bpf_sock 16-bit wide 2022-04-13 19:27:11 +02:00
vdso
video
xen xen/gnttab: fix gnttab_end_foreign_access() without page specified 2022-03-07 09:48:55 +01:00