Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4216112pxb; Mon, 30 Aug 2021 22:56:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyixIxhGU4xshG/zHINWqcxybpmEeyLS9NEV9agPLPnxXgh+sSjA/PEc4BMAuSAzKoxpGh/ X-Received: by 2002:a6b:f904:: with SMTP id j4mr10523027iog.208.1630389402008; Mon, 30 Aug 2021 22:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630389402; cv=none; d=google.com; s=arc-20160816; b=lhcIh9RHzd8LfLAGjO2SSt3RGfvUK3nHxA0IusClYlatEX1MJmxDWzPWepgeWog9// kH9za5Xwit5e22k6okFd3tWHS6YO1MUX9rMUWIWpDRyMW9kyXRlS9Rfe1tmctWBiQGSS mQhf79QMtodflkRXtfSQERkKyHrs79WPNnWfwQ3ZhwogA4+rJUPh0IDaO5DeHMe0PE4w uQthviZ64GpvSxansLGFt+UO8Gx+a0/Z33FhY7EMEirmDDPtX24MBxQTI9QqBJ+uR79Z jR57/1SVxw2BFcmfzm4q2mXlU2qd97JyE48Ae6WDSH6K/+ZymfoLw6Dt8kem9RK2Q6Uw 7yPA== 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=p1Di51SW9yWB9eM9LGqDJ0EJVwTsmoqAzsBdT0ecqu4=; b=oAkdgzmoVY1s339tSxi5QGksmtLN6MCU1XaTdKzCNHtJkHQt89fwxS4J+EGFyaZ4+V FCrdsS5286Zhar2nfyJ/cv5L29bFgcHo7mCrpsPRLpasZZ/q/TZg0rXy1zcUBJHZLvtx jNOg+j91Tbdh2oIKr7KJOOgKmg0PxoqbIznC0HuvbT8RcBou5m4MbUdNrbsmyDcVqzXH t+dTTWQT4SV93X32LIFUAxms+cd0ZR+MCCEuP1dHuyupS4/UMZ0RPdg8tEbhTeqM8ZEj vyhiEZ68wPj3Pxlt9SoqU/yKW2xPe1wcGFIMRj6OLzxjsoUBtvzOsAjwkBPhzVJcFiot awcg== 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 11si16660031ilq.55.2021.08.30.22.56.29; Mon, 30 Aug 2021 22:56:41 -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 S239259AbhHaFzM (ORCPT + 99 others); Tue, 31 Aug 2021 01:55:12 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:52368 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238782AbhHaFzL (ORCPT ); Tue, 31 Aug 2021 01:55:11 -0400 Received: from jlbec by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKwgn-00HUpL-Nm; Tue, 31 Aug 2021 05:52:06 +0000 Date: Tue, 31 Aug 2021 05:52:05 +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 Acked-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 > --