Received: by 10.223.185.116 with SMTP id b49csp5555121wrg; Tue, 27 Feb 2018 15:48:20 -0800 (PST) X-Google-Smtp-Source: AH8x227BnUvQzZZp4e/w4vUbCcYws/lH4EiXa7/B29yihRHUDHsu9spUELmtI/7p8ErAP5oPNXcx X-Received: by 2002:a17:902:7c11:: with SMTP id x17-v6mr16068566pll.59.1519775300561; Tue, 27 Feb 2018 15:48:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519775300; cv=none; d=google.com; s=arc-20160816; b=kGButmrGR/I29bR1U4ooZCzlPJG92VnfMkav6+rOYQaq6rkhdfgFZ2X6Qezp78Tn02 8HmhLm0dh5RsxMdoTNnpnPAOSnZKZVAL1JxpOpV/Qxj8L36pN2EXEOXAT8xmeqV4s/DH PJ/I8qd+HlGhzhuAzK8idisv3Z5G21NPgsRZr1O6R+//SMOkhQ9/JJyp1VbLbS2Wia1s AnvfgVNQSKNynbyIz+BU+ihDianpKle/vVgZzMbzzVnPwtQnKsVR4Ir7DNBXJbP6HwHk AZ0pKuJLxwqohjklFvlFA9Zx6W5E5a6kQjL/shmOip5WGnM6v+nwGCMaPrzLBth2p7v3 LI6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=+HFp8Iv5JxnqMfkUP7v/BDf7eAOVsI7dMMlCp9QowZo=; b=EIb9DIgGfKPdxa26y6yK24JwgbwRQe96XOzNYQyMannsiuOi01xM6GDr+kCzZWX9qv EQSEhEHdwQEyPD3MjISvUXTNatzFJQDENPxS6qUPA7jcruq55fo6sIdy4nuVE1wAjZEZ //qc4+IsVFBIdUbBfh5AqsUaBElHi92WHljxzIsDt2cnwc5VfeQpX0dNlvBL89C/u1M4 o70iAVLGE5RWH4pzXBeABzUluwbZYVtoowSice+/xF7t/i2f2KEk+iv4lyxJQYETiqEU xHluRpU5K18HV30FZv2Ryeo3JYF9a+9ndV1ZgtSjb3huR1XylgEgeLLpI6jiqK7DB+Lz 9b+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=OEGGv+wo; dkim=fail header.i=@chromium.org header.s=google header.b=GfUhsHhn; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si129468pgv.476.2018.02.27.15.48.05; Tue, 27 Feb 2018 15:48:20 -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; dkim=fail header.i=@google.com header.s=20161025 header.b=OEGGv+wo; dkim=fail header.i=@chromium.org header.s=google header.b=GfUhsHhn; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751844AbeB0Xlo (ORCPT + 99 others); Tue, 27 Feb 2018 18:41:44 -0500 Received: from mail-ua0-f196.google.com ([209.85.217.196]:33132 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751811AbeB0Xlm (ORCPT ); Tue, 27 Feb 2018 18:41:42 -0500 Received: by mail-ua0-f196.google.com with SMTP id p12so407973uad.0 for ; Tue, 27 Feb 2018 15:41:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=+HFp8Iv5JxnqMfkUP7v/BDf7eAOVsI7dMMlCp9QowZo=; b=OEGGv+wo/MPRbzHMh/x1nYLDVpK5awMaLLf+apO4NVQwBLmk+Spa6SKD3bvERIXte3 ycTVxmgP6bW0p7+WYsdF/JugKgpoeWKiCDSLBClCWniypy6hTZ5SE8OP+OzYKNbZVL0h OFcVrHnOm1JwIjdCmyXdcjtzRUgwBafjLcf0LLLaY9X/G8h6ov2nRgHXbIs0N8dn0p7G gcPtlrn9bO2bVTBAHv1CZO2IFFwvDgM9aSwp0TtcrDn4bZ2pZ9W507A4rK59ILWH2R3P H8J3tJqeLVxZknH5mQvTdgxBJYlguviFCHRoQ5EQsfIM7lQNTAQK2RgiGj15JkNG3k7S nB9A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=+HFp8Iv5JxnqMfkUP7v/BDf7eAOVsI7dMMlCp9QowZo=; b=GfUhsHhnLmhxRiVAVuDmQUYyWzDO4hsPvPdWjj6nbnta/r48F17KBDByi1fXPcilSM g7Isk0nwZajsPY7/GsO+50L5PH1edL0Bezs+ob8g/7Q8NVEsEnh/SrzeGm0++PtCatbZ EMsWiSq9k2eGoIm97wgREd425R7swqMca1bfs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=+HFp8Iv5JxnqMfkUP7v/BDf7eAOVsI7dMMlCp9QowZo=; b=ToOfyxVxE4UGwOn0LX9RfDOSqOHihfgLBEvuqUf4AUbA+pqDxpC0bmv1MaE0cCH9oe TEzoFFoNBBlWitoNRju3xYZ8a2HzfXoey6lnoUSpI1rNzr709r2hLYFH1hvgkDYEvqIb Jb4dobc7xT2csdJ6CR8jaMcWueQUIWBFESF2p2rkv78vKqn/0ni95GnScQcGTPDC2XN+ XvruCUcJF6uO0rtXlj+p7aph3yXDJQ8D7C6VXsHrUkG0pTADZ6TAOH7WGSyg8c6tZy2H XaTJRgvd172kZHTJdRMyGxiFSZX7aO0ZaXQun+Xr7PDsOJTVvazEo8d0lamW8b8RMT4Y ghhg== X-Gm-Message-State: APf1xPB0C5TMxdGGFqyp+K+synHIK39mLOwcj7JItIti6W2Im20IBRmq G5m05I7P6QnQeVljVMhcFv1d2fAC264DWqT9Z4x3gA== X-Received: by 10.176.83.151 with SMTP id k23mr12308861uaa.167.1519774901562; Tue, 27 Feb 2018 15:41:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.31.242.140 with HTTP; Tue, 27 Feb 2018 15:41:40 -0800 (PST) In-Reply-To: <20180227233156.29826-2-danilokrummrich@dk-develop.de> References: <20180227233156.29826-1-danilokrummrich@dk-develop.de> <20180227233156.29826-2-danilokrummrich@dk-develop.de> From: Kees Cook Date: Tue, 27 Feb 2018 15:41:40 -0800 X-Google-Sender-Auth: C1oJux1kjRdyHwnt1WbU2UfdjE0 Message-ID: Subject: Re: [PATCH v2 2/2] fs/sysctl: remove redundant link check in proc_sys_link_fill_cache() To: Danilo Krummrich , "Luis R. Rodriguez" Cc: LKML , "linux-fsdevel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 27, 2018 at 3:31 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 Acked-by: Kees Cook > --- > v2: removed 'err' as it's only used for sysctl_follow_link() Thanks :) Luis, do you have a tree for sysctl, or should these just go via -mm? -Kees > --- > 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 > -- Kees Cook Pixel Security