Received: by 10.223.185.116 with SMTP id b49csp5519491wrg; Tue, 27 Feb 2018 15:02:28 -0800 (PST) X-Google-Smtp-Source: AH8x2258Lkqdm4iUk5JCvpLvs2jZJcg3loE22XvLbmVWAgcu2fIiOfPSy3Iw+2Xa/8hYxnUO90tq X-Received: by 10.101.85.2 with SMTP id f2mr12885665pgr.210.1519772548156; Tue, 27 Feb 2018 15:02:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519772548; cv=none; d=google.com; s=arc-20160816; b=xynmnpbgelWpmdwgjfQX+8cYoHBbc1fvZNtWPl7QPSXGMbINoS6oWpEk+84cvkXGn7 WN2IKB/94GxgkVLp122AeuucBj+kFmu7dXtKiD6G2u5iX0qE+MMcvdGLnaAND3YngYgG v7AQ/17MeFxTE/nPirq0kAijgSHpZAXTe3e9Bhm/ZqxHF8HMdnj+Y1MecLGxsEGqBxwK Evl5iAdN9WE1Xhygm077XdgAu7kyeYrFVAvIqCelQwGIdB+XrxnTzAeouSm4tCw64Xnj uYUcKoPCoEQkZsEh4t+4aUtT/Ghz9XQPfXrFlRv7BPl1tv4TlRpKOhMuWcT1vdre/ouJ XZ8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:arc-authentication-results; bh=YHHJ1cLmrMvynPIbmrMgaANIZSFMpvY82FdbWubCin4=; b=mrj9R+CIhHjPw2rlgzDEEkj3s8xB50PryuhukF5vy0CN4sCnxa8VTeoOcvx5iNGHcM 7CW1vt0UZeWrjxRW3/TZ0y0RRELheDOSbPdF3v8ExhEcCUOd36jOdXs3zMd0hqCVgsiX JXJSCjld1lBd2hRG00lSG/BlsTHM4tmpm/gFtUUYoT3k9kqFpcHNiVDF1O3hJ+g8DZYI 0Y4Q+8HytfyDT5qeKo8bNzJtiIpfBcq8Zk3LN6egiTbnZIclDB8AzMYhR3cq596ueliW 9gFqV+HNgUrOYs8WqbUDLk0OaQbWr57obntGgTlhZ291avpMKLHC2kmvrQTNGQjG6Yw+ rP3Q== 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 k8si169848pfi.3.2018.02.27.15.02.12; Tue, 27 Feb 2018 15:02:28 -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 S1751946AbeB0XBP (ORCPT + 99 others); Tue, 27 Feb 2018 18:01:15 -0500 Received: from hs01.dk-develop.de ([213.136.71.231]:54570 "EHLO hs01.dk-develop.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751778AbeB0XBO (ORCPT ); Tue, 27 Feb 2018 18:01:14 -0500 Received: from mail.dk-develop.de (hs01.dk-develop.de [127.0.0.1]) by hs01.dk-develop.de (Postfix) with ESMTPA id 6D2491320D2B; Wed, 28 Feb 2018 00:01:17 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 28 Feb 2018 00:01:17 +0100 From: Danilo Krummrich To: Kees Cook Cc: "Luis R. Rodriguez" , LKML , linux-fsdevel@vger.kernel.org, keescook@google.com Subject: Re: [PATCH 2/2] fs/sysctl: remove redundant link check in proc_sys_link_fill_cache() In-Reply-To: References: <20180227224358.12672-1-danilokrummrich@dk-develop.de> <20180227224358.12672-2-danilokrummrich@dk-develop.de> Message-ID: X-Sender: danilokrummrich@dk-develop.de User-Agent: Roundcube Webmail/1.3.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-02-27 23:59, Kees Cook wrote: > On Tue, Feb 27, 2018 at 2:43 PM, Danilo Krummrich > wrote: >> proc_sys_link_fill_cache() does not need to check whether we're >> called for a link - it's already done by scan(). >> >> Signed-off-by: Danilo Krummrich >> --- >> fs/proc/proc_sysctl.c | 11 +++++------ >> 1 file changed, 5 insertions(+), 6 deletions(-) >> >> diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c >> index a0b6c647835e..7e7d9facb842 100644 >> --- a/fs/proc/proc_sysctl.c >> +++ b/fs/proc/proc_sysctl.c >> @@ -707,17 +707,16 @@ static bool proc_sys_link_fill_cache(struct file >> *file, >> struct ctl_table *table) >> { >> bool ret = true; >> + int err = 0; >> head = sysctl_head_grab(head); >> >> if (IS_ERR(head)) >> return false; >> >> - if (S_ISLNK(table->mode)) { >> - /* It is not an error if we can not follow the link >> ignore it */ >> - int err = sysctl_follow_link(&head, &table); >> - if (err) >> - goto out; >> - } >> + /* It is not an error if we can not follow the link ignore it >> */ >> + sysctl_follow_link(&head, &table); > > Shouldn't this be err = sysctl_follow_link... ? Otherwise I don't see > where err is used. > > -Kees > Of course, thanks. >> + if (err) >> + goto out; >> >> ret = proc_sys_fill_cache(file, ctx, head, table); >> out: >> -- >> 2.14.1 >>