Received: by 10.223.185.116 with SMTP id b49csp5518729wrg; Tue, 27 Feb 2018 15:01:52 -0800 (PST) X-Google-Smtp-Source: AH8x227WN6CMZQ+219KiFw71WLgzoxKlHG+grjOLXmi5Nm4FtI/pQwqQG8eU0JyY2CoG26QZlIzX X-Received: by 10.98.224.65 with SMTP id f62mr15644557pfh.191.1519772512547; Tue, 27 Feb 2018 15:01:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519772512; cv=none; d=google.com; s=arc-20160816; b=IKAixtZ8Xzz1usg5/zSmVFpiAuSj/P/160PanKBBj/HgbWzIhwrQ4JgUv5PWfXWxJu ArMTiAwOg3ERUA9hFSPkAyM2Po1xFxUDwArPuS/GdwvuXeybKgmiGoFogIHCa7OF5dp9 vbzfe7gbTB3RnMJs/fBl860LWWHk1L92ZJ6V7WbzhbW0LBgzMkU7rWggg9gEivr6mJLc arLYAYNKa8oA8yiqHgro9lvDuqEf0Ljoa5Gn+k0JFofB7bmeT8ofQwCZPGk+eEdN4P7a nFrQyEHyW5XrP4rn0Oi5Duw6vlbPcQN4Bo3bjsiQpTd5/R2pOP4Wj0IpyHygzF5E7ZkF h4gQ== 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=u5y75s/uLSsPJcvRoIFtdOpASbOuX+930WzcDybJs2k=; b=Zy1t3sfCGYvXkYlPvQiN2yYxkWSDXO0noSwGHmdNqdVWuR9NydypSXZ1RLhlzia/1b kQ5HluftddDh9NLG+38jEJqymC67B1J+BzA7AjtBUZrUJRQ0JxEjbiYa4GTr2MTojtYB GV4TJLb0NwBgwREFeLl2Xbs6bsejflQLk4atzcPRzTQsImMdLYjYmZfNQku+d02kOX9L LzQkhFOausdGYXysQ0F3ZGr927Qln6T5PDvwvi3qFm6XbgCO2Lr3qQWiBV4/vXZ9nzzg 0goXnYzn+8iCUFzRkCut56ohYCs5Llc5ME028esvnjfW+rBOYLjpK8eS4zViQqZ4Vb+U POYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=SeDNi9Dk; dkim=fail header.i=@chromium.org header.s=google header.b=TF5URAXq; 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 u16si157565pfl.299.2018.02.27.15.01.35; Tue, 27 Feb 2018 15:01:52 -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=SeDNi9Dk; dkim=fail header.i=@chromium.org header.s=google header.b=TF5URAXq; 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 S1751948AbeB0W7g (ORCPT + 99 others); Tue, 27 Feb 2018 17:59:36 -0500 Received: from mail-ua0-f196.google.com ([209.85.217.196]:45401 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751813AbeB0W7e (ORCPT ); Tue, 27 Feb 2018 17:59:34 -0500 Received: by mail-ua0-f196.google.com with SMTP id z3so328457uae.12 for ; Tue, 27 Feb 2018 14:59:34 -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=u5y75s/uLSsPJcvRoIFtdOpASbOuX+930WzcDybJs2k=; b=SeDNi9DkXisQ5yrM16omS5nd1K6N95OdimfLxzhSGN9V6FQiez1TJHynO43284v2S3 medtx7TEk2Zvo9UKBUxbiEC2WZa20EmRNGrHvec7VUJ6CQQ/k34kzd/oXWdqGmbGftnM j1+RpGNHGdIZTdDcH9BS2O6shUoIkKZA1kftKeNbQ9ifoY+ua/lHNF6xDWHrhag839LS Fr3u4KBcgJSAz7DJ3o+PzOcpdFcmPuz+sVfhOYy/wtBqxt6ItogxYokTzzEEeBPRxrOZ bhOsBm/9w8hiDygpjBB7iq/2B7IuE8EEzkH+EJhjOHiN8kUs000I06dBKN/wdG1AAv0/ y/GQ== 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=u5y75s/uLSsPJcvRoIFtdOpASbOuX+930WzcDybJs2k=; b=TF5URAXqqca5UNewOdBZg26ulmmBdnIHWqLiZkAniluec8ETbeuOliIeIIn8Fm46JJ o4+h0hvxfcFg6tChqZCxL9t31fnPqU11HiWux2tzH5wE2I7YnThLaunCL5/46tOHnb17 TQO/bbwCtqKFL0ZFdY5Cw78aFRij1v1+WHw0Y= 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=u5y75s/uLSsPJcvRoIFtdOpASbOuX+930WzcDybJs2k=; b=aEw8wOm+Y9FxwyeDREiYsS9iXr1XYwoCjaU8qpKj3HaStbyOy67mr7Q6qZNlvqx/cT c16LuNhA+68Xxf8jml6sLGGkXPLh+iVdX67LLhQXx9lAJ/NAZqfZP/JJnWUZtpiGs8LW atNEH4Xo8syFziGqiKMpnxR60Q/f/hW1J/PHET7BgfGEJ3pURAIM8tlqRf37UzmJw+oC fA2aH21qjj3O+kfrReFMOkcCaGjWzMWtqcinbAyNfKzShT/15I588wt8n8Ier8xzsghg U2t/kzn0PJsTU8cfjr6xcnhGkhC5eUMr2vXGJVg+C4sZaNvg9VNlKMm9Og8hfDHAvvhm UwLw== X-Gm-Message-State: APf1xPA2M7hP18AWr5lG8MTIYCUzW3sGnh5uU1dMg7N3jFYulFYSkV6H 3XExNlV+yh8mp609Wev4Z34q1/GizQZgRHVvFeELXzk0 X-Received: by 10.159.36.243 with SMTP id 106mr5076729uar.83.1519772373690; Tue, 27 Feb 2018 14:59:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.31.242.140 with HTTP; Tue, 27 Feb 2018 14:59:33 -0800 (PST) In-Reply-To: <20180227224358.12672-2-danilokrummrich@dk-develop.de> References: <20180227224358.12672-1-danilokrummrich@dk-develop.de> <20180227224358.12672-2-danilokrummrich@dk-develop.de> From: Kees Cook Date: Tue, 27 Feb 2018 14:59:33 -0800 X-Google-Sender-Auth: qOjt6uQjPknF1zSKXzmSKbL6QeQ Message-ID: Subject: Re: [PATCH 2/2] fs/sysctl: remove redundant link check in proc_sys_link_fill_cache() To: Danilo Krummrich Cc: "Luis R. Rodriguez" , 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 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 > + if (err) > + goto out; > > ret = proc_sys_fill_cache(file, ctx, head, table); > out: > -- > 2.14.1 > -- Kees Cook Pixel Security