From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16C77C4320E for ; Tue, 31 Aug 2021 05:53:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DCF746101C for ; Tue, 31 Aug 2021 05:53:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238579AbhHaFx6 (ORCPT ); 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 > --