Skip to content

Commit 35edfdc

Browse files
jaelsasserdavem330
authored andcommitted
net: set default network namespace in init_dummy_netdev()
Assign a default net namespace to netdevs created by init_dummy_netdev(). Fixes a NULL pointer dereference caused by busy-polling a socket bound to an iwlwifi wireless device, which bumps the per-net BUSYPOLLRXPACKETS stat if napi_poll() received packets: BUG: unable to handle kernel NULL pointer dereference at 0000000000000190 IP: napi_busy_loop+0xd6/0x200 Call Trace: sock_poll+0x5e/0x80 do_sys_poll+0x324/0x5a0 SyS_poll+0x6c/0xf0 do_syscall_64+0x6b/0x1f0 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 Fixes: 7db6b04 ("net: Commonize busy polling code to focus on napi_id instead of socket") Signed-off-by: Josh Elsasser <jelsasser@appneta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0f0ed82 commit 35edfdc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/core/dev.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8712,6 +8712,9 @@ int init_dummy_netdev(struct net_device *dev)
87128712
set_bit(__LINK_STATE_PRESENT, &dev->state);
87138713
set_bit(__LINK_STATE_START, &dev->state);
87148714

8715+
/* napi_busy_loop stats accounting wants this */
8716+
dev_net_set(dev, &init_net);
8717+
87158718
/* Note : We dont allocate pcpu_refcnt for dummy devices,
87168719
* because users of this 'device' dont need to change
87178720
* its refcount.

0 commit comments

Comments
 (0)