Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp131941pxb; Tue, 24 Aug 2021 22:31:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYmc83CjVz6JGhrZg9nTfyh4UbocBQnKCjOXQCmqADZMI09bjn9GmxfNNg0hFpSSzAMB23 X-Received: by 2002:a05:6402:d73:: with SMTP id ec51mr46221577edb.286.1629869513354; Tue, 24 Aug 2021 22:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629869513; cv=none; d=google.com; s=arc-20160816; b=DjlHJYOn4y2SM+N+i/cEMt2IyNY53URNf8yYHYa7rCh9U2WWPhS8/wDFo5AqIo0+pE QDqcHsJXh0dlBcap98sOaFSvIU3IsiflBKxRF3MSXEHcQpvM8rk6/0QXt9b6B4OhgLFN 5R9wQWjHfli67Shm+dE/aLXdWlDfYsnQL1wXMjEEuVI/dYOlUZlcOaQW7Ap6SuzFiD7+ kxnm8NPYQAUIF01XoY1TkcQff1kxrNeR0qIvjt1MV2zTYrfdsVMinAoynL5S/BfMFYtU 5oNXTzcQxqNssdFZjUPf7D9f0oPc7kRxa3hVK6I60NTsvtqMeXVsn2ga6kEEkoqV/xXp JaXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=zO47B1LDcFJ+HEkvWFyIUGX2YJb1L4pGU460fcpj5ZU=; b=RRQPQ0TTiLHy1MsNnFOaMeE8y4j9RSdxXtSp9XwcWo4xmZ0IOXGf0Q6OjTVYZ/VNBs juWJwLSWjPpdsA+5/0V6G5a4dIb6SgUFWh9kCMPmWUhvPc6t+uRJFUhNnsIAt2+sRnSU 8t8IgJQqRuLAc3ECjWUx77H73xhsCJz0exUQgaO3Zj5B1rffIKkilvYdaOuXicXpfBVK vVHLmy/TX81zahUCLxv+FjqFiZ7M72vnB4eNiU35kgJ4HBrw4CJ4CcY2u271CXS3LNF1 Gmxp1qiizpA8WNM7v9+40bxg+3IA3nDLbEOxiPWf0J16Hw0jkFMm5AR1kN9mmaFfiywt ehgw== 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 t12si23808782edc.33.2021.08.24.22.31.28; Tue, 24 Aug 2021 22:31:53 -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 S232096AbhHYF3s (ORCPT + 99 others); Wed, 25 Aug 2021 01:29:48 -0400 Received: from verein.lst.de ([213.95.11.211]:54736 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbhHYF3s (ORCPT ); Wed, 25 Aug 2021 01:29:48 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id EE8D96736F; Wed, 25 Aug 2021 07:29:00 +0200 (CEST) Date: Wed, 25 Aug 2021 07:29:00 +0200 From: Christoph Hellwig To: Al Viro Cc: Christoph Hellwig , "Gong, Sishuai" , "jlbec@evilplan.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] configfs: fix a race in configfs_lookup() Message-ID: <20210825052900.GA26714@lst.de> References: <20210820214458.14087-1-sishuai@purdue.edu> <20210823074636.GA23822@lst.de> <20210823170847.GA617@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 25, 2021 at 05:19:04AM +0000, Al Viro wrote: > On Mon, Aug 23, 2021 at 07:08:47PM +0200, Christoph Hellwig wrote: > > > We can't hold a spinlock over inode allocation. So it would have to be > > something like this: > > Check for -ENAMETOOLONG first; easier for analysis that way. Indeed. > > + dentry->d_fsdata = configfs_get(sd); > > + sd->s_dentry = dentry; > > + spin_unlock(&configfs_dirent_lock); > > > > - found = 1; > > - err = configfs_attach_attr(sd, dentry); > > - break; > > + inode = configfs_create(dentry, mode); > > + if (IS_ERR(inode)) { > > + configfs_put(sd); > > + return ERR_CAST(inode); > > Er... Won't that leave dentry with dangling ->d_fsdata? Yes. Existing problem, though.