Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1542108imu; Thu, 13 Dec 2018 17:48:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/VnQ6nIjfaqyxEXt5+PgpCUFTj59Yrr8aNZxGcqg1HmSI6J1chjPpiah/XCcyZjbVCOd0b7 X-Received: by 2002:a17:902:8bc6:: with SMTP id r6mr1073218plo.67.1544752104059; Thu, 13 Dec 2018 17:48:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544752104; cv=none; d=google.com; s=arc-20160816; b=LdiQoHyRmQdsbsmLXaOmNoL5UqThenlqa0gOVQ63a2V14vQ/4dEuU9nEtJPD1Twre7 ZsGGO1ocSX34qpmXvZeqAm05hRB98LGWIjhmhnnABAk9sora79R7o4nQYL+S5w814FZM p5XnQF49iLHdUwlFk7VK+2eEbFctHsd20Ig8dUCmISFGTwSxjRwObQUOBbtz8GbzOZJZ JSoN2wfh7jHVVpq2x9pIg3qAx+m2WELiO3rKPHmxKKZrKja045QV46gdqAKIeAjEHxlw V/kkDFz0cSyb8wcPIuszPR6JyZT/IN0FbH2XL2Wd6YbzSfCLcxruMqCvoSuY3wIaE3ad v98w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zjPhFgb8YRhUHstMAbssWWKjGe2WuZHEQrWTYeLZnpg=; b=DE9C8oV2y9fOIz+Oubk1WdC3kV5pWZ6RLMjgLi44EUhJAtAm66Ui2FWZ3ENLs5DpDH 4wcAAtCJ//ka2VTW/InikVpkVoOoFPGcT0reDg/YHgarIPqRX9up/7ZepsoOTQcd8FF+ MyfbNYnSYzGN6xcC24WY9pShY1FR5+svvz8jQDaUyjDYNHghzvvnkLM2lciM1R7x+GdN SeEZE7kySjO/kR28oO9YYBbXcUNbs+v/8jd6n4W89SwDp53IGi30NmI+tw9wlnpCR+4q 6NdR1TSYXRvcgn/AXHcYwD4+swGuMWdo+w64JNmVlJHHsQCzXsIargU7AQ9UJ44q7aR/ 5Z7A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p189si2925888pfb.0.2018.12.13.17.48.07; Thu, 13 Dec 2018 17:48:24 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728989AbeLNBp4 (ORCPT + 99 others); Thu, 13 Dec 2018 20:45:56 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:54792 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728130AbeLNBp4 (ORCPT ); Thu, 13 Dec 2018 20:45:56 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.91 #2 (Red Hat Linux)) id 1gXcXs-0003OP-GP; Fri, 14 Dec 2018 01:45:40 +0000 Date: Fri, 14 Dec 2018 01:45:40 +0000 From: Al Viro To: Ivan Delalande Cc: Luis Chamberlain , Kees Cook , Andrew Morton , "Eric W. Biederman" , Alexey Dobriyan , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2] proc/sysctl: don't return ENOMEM on lookup when a table is unregistering Message-ID: <20181214014539.GO2217@ZenIV.linux.org.uk> References: <20181213015742.GA28776@visor> <20181213065826.GL2217@ZenIV.linux.org.uk> <20181213232052.GA1513@visor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181213232052.GA1513@visor> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 13, 2018 at 03:20:52PM -0800, Ivan Delalande wrote: > @@ -474,7 +474,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb, > if (unlikely(head->unregistering)) { > spin_unlock(&sysctl_lock); > iput(inode); > - inode = NULL; > + inode = ERR_PTR(-ENOENT); > goto out; > } Applied, with one modification: if you look at the target of that goto, you'll see out: return inode; so this place should be simply spin_unlock(&sysctl_lock); iput(inode); return ERR_PTR(-ENOENT); } That way the label becomes unused and goes away.