From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78286C48BE0 for ; Thu, 10 Jun 2021 21:18:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 63FA761362 for ; Thu, 10 Jun 2021 21:18:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230401AbhFJVUm (ORCPT ); Thu, 10 Jun 2021 17:20:42 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:50394 "EHLO mail.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229963AbhFJVUl (ORCPT ); Thu, 10 Jun 2021 17:20:41 -0400 Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) by mail.monkeyblade.net (Postfix) with ESMTPSA id AFEAA4F7DFB96; Thu, 10 Jun 2021 14:18:43 -0700 (PDT) Date: Thu, 10 Jun 2021 14:18:43 -0700 (PDT) Message-Id: <20210610.141843.1491689012491247186.davem@davemloft.net> To: changbin.du@gmail.com Cc: viro@zeniv.linux.org.uk, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, xiyou.wangcong@gmail.com, David.Laight@ACULAB.COM, christian.brauner@ubuntu.com Subject: Re: [PATCH v3] net: make get_net_ns return error if NET_NS is disabled From: David Miller In-Reply-To: <20210610153941.118945-1-changbin.du@gmail.com> References: <20210610153941.118945-1-changbin.du@gmail.com> X-Mailer: Mew version 6.8 on Emacs 27.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail.monkeyblade.net [0.0.0.0]); Thu, 10 Jun 2021 14:18:44 -0700 (PDT) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Changbin Du Date: Thu, 10 Jun 2021 23:39:41 +0800 > There is a panic in socket ioctl cmd SIOCGSKNS when NET_NS is not enabled. > The reason is that nsfs tries to access ns->ops but the proc_ns_operations > is not implemented in this case. > > [7.670023] Unable to handle kernel NULL pointer dereference at virtual address 00000010 > [7.670268] pgd = 32b54000 > [7.670544] [00000010] *pgd=00000000 > [7.671861] Internal error: Oops: 5 [#1] SMP ARM > [7.672315] Modules linked in: > [7.672918] CPU: 0 PID: 1 Comm: systemd Not tainted 5.13.0-rc3-00375-g6799d4f2da49 #16 > [7.673309] Hardware name: Generic DT based system > [7.673642] PC is at nsfs_evict+0x24/0x30 > [7.674486] LR is at clear_inode+0x20/0x9c > > The same to tun SIOCGSKNS command. > > To fix this problem, we make get_net_ns() return -EINVAL when NET_NS is > disabled. Meanwhile move it to right place net/core/net_namespace.c. > > Signed-off-by: Changbin Du > Cc: Cong Wang > Cc: Jakub Kicinski > Cc: David Laight > Cc: Christian Brauner > Suggested-by: Jakub Kicinski As this is a bug fix please rebase on the 'net' tree and provide a proper Fixes: tag. Thank you.