Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1934732imu; Sat, 26 Jan 2019 14:41:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN4ubOMTLIUaFZ4xUUlhNGB+BrARgvA3ow6i36Wgf+alLNNBLbJQO+lvEsrBPUNH5+e/1wlu X-Received: by 2002:a17:902:7044:: with SMTP id h4mr16240626plt.35.1548542506484; Sat, 26 Jan 2019 14:41:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548542506; cv=none; d=google.com; s=arc-20160816; b=Jw6KGtw+xFIN4uW+LlS0Z+GmXT/SN7QdaBLUaOTNL/I6RzbCtTTM6r6XT79j8Qsniz JtoIm7/yCEGTebLmN+AK7g0Tm0K1WumMwGqDGF0LyqppYWeWvolb415UjTpJiaWTInda 61JBpyPgnNehbwwpS77RzoorelnI6UbOjXDHo7jWq3i8xwc9zqatfBfan1JV5Y7LGyOK l6CwPHehY0YVzNPIqmgZ4NSf0RVhpvCGdWAm8LQjGJtpxemg7XPbtcBs3dmwAOUDjgUR pkLJa55qdKKfZikwwupNFyanCeZ1pE6PgK2V5T+i9LGWQQJ2hGFxwoEZ34vqC1QvFxBE ePDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=czvbKr9B+EvUXOh/KxPcjLLJafEzm1/2XYBjHSTOhQs=; b=zzPuOJn5SbeEx1kwR+zS9Lcy4BMvhnEfYjWHw8MQaGPK5nkyIXhKfXb0PY+GKQSkLP bK9YJIJABc4NYsSIJ06a3axfWHAdnLDbZ8zEJVMGWBywn1xhb4qDYHfmdvOh1HxFKFt9 pbwdEaXyhGMa97GTXRF9D1OfZHnpMMeJPFG0bR7TUnDYSvEADb0pN0CE6DMW3y2pNt8g NZrHTwP8pFxIZR78/ZCJYnALKibx7Cg0aFLG8KudZQWWOTYHjS375aMT+eW7rQqo4Ma5 u7dEhFVIEy3+0YL+2BEAHRwOVScMj5ovFvNCJy2fbol8PoWM2P8vaTuflzIe1cfrGf92 xMvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@appneta.com header.s=google header.b=qBfziX+p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=appneta.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m78si7187341pfj.48.2019.01.26.14.40.57; Sat, 26 Jan 2019 14:41:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@appneta.com header.s=google header.b=qBfziX+p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=appneta.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726413AbfAZWkP (ORCPT + 99 others); Sat, 26 Jan 2019 17:40:15 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:40671 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726189AbfAZWkN (ORCPT ); Sat, 26 Jan 2019 17:40:13 -0500 Received: by mail-pf1-f196.google.com with SMTP id i12so6296806pfo.7 for ; Sat, 26 Jan 2019 14:40:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=appneta.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=czvbKr9B+EvUXOh/KxPcjLLJafEzm1/2XYBjHSTOhQs=; b=qBfziX+pXsXKKxv+8RCJRt7Io03DQrtTVbUCYoerDHnO86KlfSKF9C871eNVzqwL0O n6DgJthFSjtNT8BhrZvJblwJFSiDod/iT8z3JfZOHzsuQvzN5ZnQEFNoxpglpMUE4CTH /t006cfLbLHt5i9k7EZqcwVn7k3sP1ukiwbt4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=czvbKr9B+EvUXOh/KxPcjLLJafEzm1/2XYBjHSTOhQs=; b=OkdERzgcjE62g46SXIEgVIleDYM9iIYIFbW6oEW6hg4QAiQoF3OM8W1OlMcN9vDTQz ptYQDDOdonh34NsbcPaxHTu/HwQ0z/9HOWSlXAJxlaF58iccboWEZ029kqM4mt5nuMDL 8jF6lEmhx3XfXSrzh7yYVKwWAjfAJ6b7ruDO1Awzr55haidQKmDcs3dcuP5AVDd2V4A1 EF9wRkZxVF6pH2IV6WZvb3NA6cEqI5JrcafxTdVzsJ18pxELlsAjHzC7xtw/o+dB6AUq P+dCnZ2fwekprO+0lCg+qhJa9aRRKclSKVWFWniG2yddqzgnBqIu7uns9AW1caJCMHTX Wv4w== X-Gm-Message-State: AJcUukf7TN6YMj434ArZxLLmD8r50TQ8Z7tn1I33rSD6OhbEvKuHG0Oj ryN46meI2ESCY1t6bU2VEN/7dMnp0+Dz X-Received: by 2002:a63:d005:: with SMTP id z5mr14682425pgf.64.1548542412547; Sat, 26 Jan 2019 14:40:12 -0800 (PST) Received: from debian9-jae.jaalam.net (dhcp-128-189-224-133.ubcsecure.wireless.ubc.ca. [128.189.224.133]) by smtp.gmail.com with ESMTPSA id p2sm38441308pfp.125.2019.01.26.14.40.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Jan 2019 14:40:11 -0800 (PST) From: Josh Elsasser To: "David S. Miller" Cc: josh@elsasser.ca, Josh Elsasser , Edward Cree , Kirill Tkhai , Jiri Pirko , Petr Machata , Eric Dumazet , Amritha Nambiar , Alexander Duyck , Li RongQing , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net] net: set default network namespace in init_dummy_netdev() Date: Sat, 26 Jan 2019 14:38:33 -0800 Message-Id: <20190126223835.14613-1-jelsasser@appneta.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- net/core/dev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/dev.c b/net/core/dev.c index 82f20022259d..d1043d49979c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -8712,7 +8712,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. -- 2.19.1