summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJosh Elsasser2019-01-26 23:38:33 +0100
committerGreg Kroah-Hartman2019-02-06 17:30:07 +0100
commit5f1a18e05b07913c9e26f5fe3c41fa56679d6c31 (patch)
treebfa385890e8ebf40b5cc06fa3b17bce1ef9bd8a8 /net
parentnet/rose: fix NULL ax25_cb kernel panic (diff)
downloadkernel-qcow2-linux-5f1a18e05b07913c9e26f5fe3c41fa56679d6c31.tar.gz
kernel-qcow2-linux-5f1a18e05b07913c9e26f5fe3c41fa56679d6c31.tar.xz
kernel-qcow2-linux-5f1a18e05b07913c9e26f5fe3c41fa56679d6c31.zip
net: set default network namespace in init_dummy_netdev()
[ Upstream commit 35edfdc77f683c8fd27d7732af06cf6489af60a5 ] 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: 7db6b048da3b ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 1f1aae27d41f..af097ca9cb4f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8599,6 +8599,9 @@ int init_dummy_netdev(struct net_device *dev)
set_bit(__LINK_STATE_PRESENT, &dev->state);
set_bit(__LINK_STATE_START, &dev->state);
+ /* napi_busy_loop stats accounting wants this */
+ dev_net_set(dev, &init_net);
+
/* Note : We dont allocate pcpu_refcnt for dummy devices,
* because users of this 'device' dont need to change
* its refcount.