Received: by 10.223.185.116 with SMTP id b49csp5631105wrg; Tue, 27 Feb 2018 17:36:57 -0800 (PST) X-Google-Smtp-Source: AH8x227j0qgPFwO4vHSPRtiP96GmigOBtWQOykeUuw0YC/cqoy12EjaaHjN10Ti3+t5Ydk3BQwnx X-Received: by 2002:a17:902:710f:: with SMTP id a15-v6mr15795408pll.87.1519781817578; Tue, 27 Feb 2018 17:36:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519781817; cv=none; d=google.com; s=arc-20160816; b=UK4nJ4Bv029/9XbV24pUHiX/cSS0qb++XbVAcjtXPIcyNx0zlSEb9+IJsFwqJH7H5E 7ATMTJY6F1DangLfQ04aZx7WhybZAAD6dhPGt3dUnJNV2IrXf2ob/ApZFElplAtHb1WA 055+m0eRDkewt2ZKwiYUqj5qj8RcKu4C7FpcOXgMG+nz/HUZ7taMyAxU0Igf9VnbPLhJ 5w+A3LTgwHVE8FMIhdc6woTdvifjYvlAN154tyOUkPT7x15O0Aalnoh/3ua0LR4e50p0 OzVFGBTxF6NTN5FWNQpvL5JSqp8She83N9J1c+nGkH+t8rL2knJACN2w+zQwH5W8aMOi d1Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=3nyiqAYRyk/5oUOwn7AJw9kK2px2WNwjh0ZnURE1Jlc=; b=HT13x+W87f5tXpuShSQg4NPUwUKWRbUoACjIezkLy9JCtx+WbOcpSIukI6YAGhAjNV tQ9O50IofpkFfl8Lb+hgYS2ZNJWvb5Smhewm3nX0eVplDBgrR91yfZuKC50XXs+dw1bz fLR15JgiCGI6lswZ+/MmcpTEf9oWxpOgxiiD8CdVwEYyelMWYDLcMqiRUpTpX0okDGLU NtSINigJJIlS99OJDvsABUUO0nG13C4EVjxjjV1dDnPSgivJ8zWa07juSqWrlwHbuKK7 mN0tAPnBlNDk+cZfZFTBI1sE7rTNhCceAa0WCbznpGlDc19EqIfIR913B79ZHVFOn9Ki n7ng== 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 j25si285241pgn.657.2018.02.27.17.36.42; Tue, 27 Feb 2018 17:36:57 -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 S1751940AbeB1Bff (ORCPT + 99 others); Tue, 27 Feb 2018 20:35:35 -0500 Received: from hs01.dk-develop.de ([213.136.71.231]:43619 "EHLO hs01.dk-develop.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751827AbeB1BfO (ORCPT ); Tue, 27 Feb 2018 20:35:14 -0500 Received: from danilo-linux.fritz.box (ipbcc13fda.dynamic.kabel-deutschland.de [188.193.63.218]) by hs01.dk-develop.de (Postfix) with ESMTPSA id 6DE841320F72; Wed, 28 Feb 2018 02:35:15 +0100 (CET) From: Danilo Krummrich To: mcgrof@kernel.org, keescook@chromium.org, akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Danilo Krummrich Subject: [PATCH v3 2/2] fs/sysctl: remove redundant link check in proc_sys_link_fill_cache() Date: Wed, 28 Feb 2018 02:35:06 +0100 Message-Id: <20180228013506.4915-2-danilokrummrich@dk-develop.de> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180228013506.4915-1-danilokrummrich@dk-develop.de> References: <20180228013506.4915-1-danilokrummrich@dk-develop.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org proc_sys_link_fill_cache() does not need to check whether we're called for a link - it's already done by scan(). Acked-by: Kees Cook Signed-off-by: Danilo Krummrich --- v2: removed 'err' as it's only used for sysctl_follow_link() v3: add ack --- fs/proc/proc_sysctl.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 82ac5f682b73..d36ef667c0a8 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -712,12 +712,9 @@ static bool proc_sys_link_fill_cache(struct file *file, 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 */ + if (sysctl_follow_link(&head, &table)) + goto out; ret = proc_sys_fill_cache(file, ctx, head, table); out: -- 2.14.1