Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4215622pxb; Mon, 30 Aug 2021 22:55:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaAzPBa/IAApTAA9E5hOkApzj0vlJXklcnjpzHy4xXOkP37X6niGXgVCnBtIMiak9ORU1z X-Received: by 2002:a05:6402:1512:: with SMTP id f18mr28012878edw.303.1630389343029; Mon, 30 Aug 2021 22:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630389343; cv=none; d=google.com; s=arc-20160816; b=xFHJtPNtKQTlRQlgQH9ikbgCCpkB3gw1ndJyk2cSCXrTmnBxMKDu3jecesSrkBLS/e UzZ0/WYLwpdk8WAt5JnRvrUp6s344IYdt3b4mLnviRkxvnMbz90jGxKjY4k0XEfHZZ6l MbM8e+293TlT/UcYlJ9D0CvwC4TL4UH4zktYD5ebiARbRgP52GyDAwX1id38Qy4r5Mpe h9K0Yalo1ICqEe3lmyO4Qcd6zfCRzOBgX9uC3Cs8//Yudrm0mutgBHTQ50J/gnMrdD9h lsTChwZUVIGDIgXjnyBFWt4ic+Wm0Ol+AIYVDHHOWaZd0nCRnEzHUVeyQKcBL5kmK6Nf QDcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date; bh=CbxRwcbbMDxyEulUDuRQjUvh5TjdtcRdWDgqqspWbr0=; b=oJ7AoEfC4fb8ikJrf0r4k4xAjaB5nPZDMnuqueMAtx4OrJHFCkOcfK6CwEKodkBAS8 rV+dojTXGZzgfmRCOdvtYwg+0CkELent+tZRfo84FIr7U2RMCjyk33NKpx6m0S4+NLu3 4x8khfWc6yrdbowaneLrLhWrUqlWG63vf9FpTsGdT2WMcSdoxSKZi3FxT00QQKSfV8qg qDIU+VWBOYTKEhN7fLlcybCSe6FeW/xGakhGkycLW9k3/prgRzjjukUnKrpCKOeAWpzN zh3JJCFVmJOyXiYYowD6yuDU6wqHoMx1cmUYvpNCYfwhG5mn8QLEmw9uaCNke6fLGixD yLgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q16si17090710edw.549.2021.08.30.22.55.05; Mon, 30 Aug 2021 22:55:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238178AbhHaFx6 (ORCPT + 99 others); Tue, 31 Aug 2021 01:53:58 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:52340 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231397AbhHaFx5 (ORCPT ); Tue, 31 Aug 2021 01:53:57 -0400 Received: from jlbec by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKwfX-00HUnl-Tb; Tue, 31 Aug 2021 05:50:48 +0000 Date: Tue, 31 Aug 2021 05:50:47 +0000 From: Joel Becker To: Christoph Hellwig Cc: Sishuai Gong , Al Viro , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 1/4] configfs: return -ENAMETOOLONG earlier in configfs_lookup Message-ID: Mail-Followup-To: Christoph Hellwig , Sishuai Gong , Al Viro , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <20210825064906.1694233-1-hch@lst.de> <20210825064906.1694233-2-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210825064906.1694233-2-hch@lst.de> X-Burt-Line: Trees are cool. X-Red-Smith: Ninety feet between bases is perhaps as close as man has ever come to perfection. Sender: Joel Becker Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reviewed-by: Joel Becker On Wed, Aug 25, 2021 at 08:49:03AM +0200, Christoph Hellwig wrote: > Just like most other file systems: get the simple checks out of the > way first. > > Signed-off-by: Christoph Hellwig > --- > fs/configfs/dir.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c > index ac5e0c0e9181..cf08bbde55f3 100644 > --- a/fs/configfs/dir.c > +++ b/fs/configfs/dir.c > @@ -456,6 +456,9 @@ static struct dentry * configfs_lookup(struct inode *dir, > int found = 0; > int err; > > + if (dentry->d_name.len > NAME_MAX) > + return ERR_PTR(-ENAMETOOLONG); > + > /* > * Fake invisibility if dir belongs to a group/default groups hierarchy > * being attached > @@ -486,8 +489,6 @@ static struct dentry * configfs_lookup(struct inode *dir, > * If it doesn't exist and it isn't a NOT_PINNED item, > * it must be negative. > */ > - if (dentry->d_name.len > NAME_MAX) > - return ERR_PTR(-ENAMETOOLONG); > d_add(dentry, NULL); > return NULL; > } > -- > 2.30.2 > --