Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp126718pxb; Tue, 24 Aug 2021 22:21:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzigNC2eOyYbrchMuz5l5vx/5ZWYVvF0SAuj6GcieRBkxCsSrt2KgnhLNWN9oE62QNj+8iT X-Received: by 2002:a17:906:9b53:: with SMTP id ep19mr19955239ejc.86.1629868892534; Tue, 24 Aug 2021 22:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629868892; cv=none; d=google.com; s=arc-20160816; b=I+zDDbBhYloMFGdnWTR4E1tE0NQwaF4SDjZ4chggBCHpZ9y7IbSJef+ds2hehZ+v4J BdX0V6twQcGklS1J1UYHUcCLNBIbgYaj/H/sjlsZawtkNtXvlh7dRa7jqjVvCQU+Ah0z /C50OWGqBGMAZZQcgfIjqxSY7YjzbLIUYQIDeEVr0MtLkvDOK/T7kSV10CE3RGKMz71q HqZz9jhzW1vp3uL+mZl2Lbxxfz6u2Ct6il/vyGrDKTa+bt1Ov+A1kjgiwTQNvzFyELeW 3q4S8eKW45OhakdBIPWul/buAflr130ZszRblrXAnFVb7SoqyASxkegEikm4JaCXtOMe r82A== 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:message-id:subject:cc:to:from:date; bh=F8IdMrBDP9SBhHbBrTIsLQ8x4TALeM7ZPEvsbrq92MY=; b=C14ksNLv5rv2KHDkybRKJMZlr8qqInXIZSdRBeGgQUZ6gRmz/Mzp00P+6fRIuPk9Wv wj1IibuLReUQUBSFvSFrKMw6LHg3xcUf+8zMoHGVnql7kzzUKoyD040EFQSmNn9CwOSW 85c0ZBy7dPlq6Fu520bEvMikbPcAfcW6NSQDKeMyZ+oPBPg0o74EPThJ0KpWCw71E/To VGBOQeOcJswCKWEk1n6PFA4VQdTrblo1V1WcaNGSADWdKh8g+AiosOWlfaoZKDGhy9DF 8s/KiEvlDqPbJTHq0aS7/CFEmS5u4DBCGCT3/LNnbBiQzIt55mvoZbb8OdfpSaZiSBhC fWPg== 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 gs30si1926833ejc.274.2021.08.24.22.21.09; Tue, 24 Aug 2021 22:21:32 -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 S231775AbhHYFT4 (ORCPT + 99 others); Wed, 25 Aug 2021 01:19:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbhHYFT4 (ORCPT ); Wed, 25 Aug 2021 01:19:56 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60530C061757 for ; Tue, 24 Aug 2021 22:19:11 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mIlJY-00FqEt-Gy; Wed, 25 Aug 2021 05:19:04 +0000 Date: Wed, 25 Aug 2021 05:19:04 +0000 From: Al Viro To: Christoph Hellwig Cc: "Gong, Sishuai" , "jlbec@evilplan.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] configfs: fix a race in configfs_lookup() Message-ID: 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: <20210823170847.GA617@lst.de> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > + 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?