From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2716F1386A8; Tue, 6 Feb 2024 12:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707221363; cv=none; b=EOtQi83F3qgbvKzZQal4n20UQbfWOkvxzcAkwMhPlkFpvl9oaQ3BSdmhSZGv1QpSyhQao7w5KVSyYx6nwxks7pRPDEZfSWSAo0fcwjff0D4DcHkRnWKt14E5LlADXnQHtY66Qd9/AybVVhcA7cwM6lid8XXG83SIG9+1m4Y6/gk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707221363; c=relaxed/simple; bh=bXsar5R8Z/J/4GcAeyNBhLTiQlp64pDEtOV6uUPgCcU=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=iwDdkAlUQr+Eu5VlJxUOYeuy9Wb+7XFlpGkbIBoXCmiPQidqM8K1Hj770LTw2s0MU8O1qBrwalrbKWykQIUOfq7n9g7acVkQhTvZOCM8NA6bSyhsjIcuhf/VZ4hl21EqFfqdxro817piU3auD8oajToz3PzNBhdwU6Olytw1Yww= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C479FC433C7; Tue, 6 Feb 2024 12:09:22 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rXKGt-00000006bFq-0z3I; Tue, 06 Feb 2024 07:09:51 -0500 Message-ID: <20240206120951.095364893@rostedt.homelinux.com> User-Agent: quilt/0.67 Date: Tue, 06 Feb 2024 07:09:34 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Linus Torvalds , Greg Kroah-Hartman , Sasha Levin , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Josef Bacik Subject: [v6.6][PATCH 29/57] eventfs: Make sure that parent->d_inode is locked in creating files/dirs References: <20240206120905.570408983@rostedt.homelinux.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 From: "Steven Rostedt (Google)" Since the locking of the parent->d_inode has been moved outside the creation of the files and directories (as it use to be locked via a conditional), add a WARN_ON_ONCE() to the case that it's not locked. Link: https://lkml.kernel.org/r/20231121231112.853962542@goodmis.org Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Andrew Morton Reviewed-by: Josef Bacik Signed-off-by: Steven Rostedt (Google) (cherry picked from commit f49f950c217bfb40f11662bab39cb388d41e4cfb) --- fs/tracefs/event_inode.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 590e8176449b..0b90869fd805 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -327,6 +327,8 @@ create_file_dentry(struct eventfs_inode *ei, int idx, struct dentry **e_dentry = &ei->d_children[idx]; struct dentry *dentry; + WARN_ON_ONCE(!inode_is_locked(parent->d_inode)); + mutex_lock(&eventfs_mutex); if (ei->is_freed) { mutex_unlock(&eventfs_mutex); @@ -430,6 +432,8 @@ create_dir_dentry(struct eventfs_inode *pei, struct eventfs_inode *ei, { struct dentry *dentry = NULL; + WARN_ON_ONCE(!inode_is_locked(parent->d_inode)); + mutex_lock(&eventfs_mutex); if (pei->is_freed || ei->is_freed) { mutex_unlock(&eventfs_mutex); -- 2.43.0