Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1394951pxj; Sat, 12 Jun 2021 07:19:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/qOVc9asiIjZRPHZEq+VZffTqeFTTE1lMxCObK4o82H2YHf5kR0ACEctAerU/8U/ipJu6 X-Received: by 2002:aa7:d755:: with SMTP id a21mr8949358eds.146.1623507566405; Sat, 12 Jun 2021 07:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623507566; cv=none; d=google.com; s=arc-20160816; b=bnLxSceLZA+Wk7sOR8wvRrwSOFy9gNTNFVOTegd7wfMlQtwh03SXuu03nthwITzbl2 EaMTXGi28+uOn6F5K72P0Pf4gfBofaxCsJgB5brbKo0m/m9TpgvGBcC4Hu23taxI+ab4 caZEwd4CR7qkb32QEhnog1RWRZ4Zxy2leu/Ei0k/zcdl8DVPyg0+DsCE8pF5YJegWh3E bmGZAoc1fsnH5dLGR57EL4eIKYS9pZcLOtzggKv9h4Sw9sZr9Lj8NQlWNpgSeed2OkrM qK47j9erOOexQPzP60RCe+YyI25QDfD7SWQ+lcSx1uROdeIPoQP2hiyoxcZq2ZdX4eVa qvJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=h1u5yKQzxyPuX4E8zKsVFCVyadXwrR0QMWt+BuSXfh4=; b=zUOswoHZ/YsYVBmbY4BZERzWqXiNPnkzXMdhMWqbspyk0Lo6I6x43OxSIfe5texyRM OnsTS4GUWwbMJVeL+m9mgd+2imA1AS2qOpyAHQWm8SbCVPswxLNmMNCUKqovehfOrulM alENfh+pnR8O1t1dv9PHJJuM1JZWKmvuf6rX82Em3mhiGWkXMBpPJueoQrpJuciFUg1p jLDBcBILBmyAsszXuny2i1//BGplM8RhAiEKBtwx8cPJHqVeS0o6aXoZZs6zLUH/+NLX 6wsh51FYz8UC+pTnIeWs0Zp/Jc7MHy5xKVa8/b7IkovLRIkYJvbFaV+Hc+EevHsAGO97 h6Ow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z21si6861441eja.498.2021.06.12.07.18.50; Sat, 12 Jun 2021 07:19:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231332AbhFLOMJ (ORCPT + 99 others); Sat, 12 Jun 2021 10:12:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:49296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230191AbhFLOMJ (ORCPT ); Sat, 12 Jun 2021 10:12:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E4FF361376; Sat, 12 Jun 2021 14:10:07 +0000 (UTC) Date: Sat, 12 Jun 2021 16:10:05 +0200 From: Christian Brauner To: Changbin Du Cc: Alexander Viro , Jakub Kici nski , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Cong Wang , David Laight Subject: Re: [PATCH v4] net: make get_net_ns return error if NET_NS is disabled Message-ID: <20210612141005.igoy2di6xhbkg7cq@wittgenstein> References: <20210611142959.92358-1-changbin.du@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210611142959.92358-1-changbin.du@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 11, 2021 at 10:29:59PM +0800, Changbin Du wrote: > 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 > Fixes: c62cce2caee5 ("net: add an ioctl to get a socket network namespace") > Cc: Cong Wang > Cc: Jakub Kicinski > Cc: David Laight > Cc: Christian Brauner > Suggested-by: Jakub Kicinski Looks good, Acked-by: Christian Brauner