From patchwork Tue Feb 6 11:32:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 197343 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1481795dyb; Tue, 6 Feb 2024 03:51:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlv2bZzMebcFUUgbqbHiq4jGxtvZ0Bi0rrVCZx0p/i28qvWMcPT+w16gxVqT73jJdyx2Gx X-Received: by 2002:a05:6a00:2da7:b0:6e0:46fc:c2f7 with SMTP id fb39-20020a056a002da700b006e046fcc2f7mr2557345pfb.8.1707220286720; Tue, 06 Feb 2024 03:51:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707220286; cv=pass; d=google.com; s=arc-20160816; b=PSWtJSfZoEEWoV7vukJex2If2OTeZC3jccTLeLJUCgeCmle6U7Dzr6CXqAGBgloesW ubPCp/Xqn9P+UrPeM+Q5kBSIhQ8TjWslCJXxiDUMsQFIZIMLD+Zzeu+EqUvxmSbmn30h MnRbSurH3G2v046/8dNww2W1UXWGjvGV9lCHTIr75ulBcqQPeV29yO4E6j4F2TtHYeuf xFgNxaF/njvqr4cloN9WRz8zysiEB0tdbwvudg/sthqvlNDAlN/Qc23NrHJDxhdgUwpl DQ63SfDeNEyU8Jeq3uy8g7lc6PvkdWIrTttclMySpuk0yrQKj0dXmbc53pVrZddZTLEE 8+Uw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=Vc5Hl8wHLvI4a/MX2Qudri1ew2Nu0ownXruYvDF/VTo=; fh=//Q9oHG9xDAus2xGOuEUhvwTZf3qOeF1NOFCBNeMCGU=; b=K/kKfubdbP1yI7goZWthJq0YVGE4g/rQEZq5hMpFoWpXXqbtx0Dq99GohtiUbG89fQ ZfHVXCS9b8drn4v5hUlklQ7xwo3saxS5Y4Ak2Lan6n0rWf7NLjDUKC7Hjv27LUTGouBA fmEsFixytV182E2tSmAqTA6Up2DabTUkuD8i4bpjU2z+h5XbjU3y4iZDQoz4xQU2U/e1 daUTyqm/nlcXeg8mw0/dlkOFj3BMIjf6G33AF/pBcnJC/LgM1JOMn/Y1Op3SUhUH07UD IntKmZQ2LwguqelG5HRknTLYNUj8q3VQL7w/A/8UyKJdIqpmNohQZhNLbXcGAQrB7PXa 3JKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54801-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54801-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWrzWMPKxjTsGYGNyuYMPixgTWoscjJTPu5y8lUupNhQk9ieBNvPQKsuG8ZVhDC5QVznvoAOrn/1JJvnkmJnTezWpG0Qg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p2-20020a63fe02000000b005dbf2ca6e6csi1466583pgh.714.2024.02.06.03.51.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 03:51:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54801-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54801-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54801-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 74D0B2854D0 for ; Tue, 6 Feb 2024 11:51:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2654A1384AC; Tue, 6 Feb 2024 11:33:38 +0000 (UTC) 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 7359113474A; Tue, 6 Feb 2024 11:33:32 +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=1707219212; cv=none; b=qYY6gV65qVnQtVLBYAmRc72mjzKIbSadKF5G6pSpsbbrKJDXtFEqoKMcDT1kDhtUodc6yD+g5HbtO6vrGRShIsCeWUSgBvqFJBq2Xj6dXdS5BCv8gs1E6sl17J2Y/Gefpd8tlsPhCjZGF+yWUOiEzrFCkgz4ODD+DNKS+BOJd1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707219212; c=relaxed/simple; bh=/K/tqg9istqeXtA6KzMmoqfKg3qYs4d2GHKRR+nK7sY=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=BaFmHSQJ6VY/N0eyuH+Py26guINifwbzU3PawqeZZRlMW0K4ZiuId53M1Rkh2BTDy6CcszPRqzq3Xr9yVWdoy5VLjYaHll7EGljpv7YlmCCSQeIoBm9ObXj2mRPwG8sYhhwhyAuKVHINzaN3x29Mj41Mz6kE9++NIej/R9EYhKY= 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 134D1C3277D; Tue, 6 Feb 2024 11:33:32 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rXJiC-00000006aNJ-27Hk; Tue, 06 Feb 2024 06:34:00 -0500 Message-ID: <20240206113400.362338010@rostedt.homelinux.com> User-Agent: quilt/0.67 Date: Tue, 06 Feb 2024 06:32:12 -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 , Christian Brauner , Al Viro , Ajay Kaher , kernel test robot Subject: [v6.7][PATCH v2 14/23] eventfs: Initialize the tracefs inode properly References: <20240206113158.822006147@rostedt.homelinux.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790150219629787502 X-GMAIL-MSGID: 1790150219629787502 From: Linus Torvalds The tracefs-specific fields in the inode were not initialized before the inode was exposed to others through the dentry with 'd_instantiate()'. Move the field initializations up to before the d_instantiate. Link: https://lore.kernel.org/linux-trace-kernel/20240131185512.478449628@goodmis.org Cc: stable@vger.kernel.org Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Christian Brauner Cc: Al Viro Cc: Ajay Kaher Cc: Greg Kroah-Hartman Fixes: 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202401291043.e62e89dc-oliver.sang@intel.com Signed-off-by: Linus Torvalds Signed-off-by: Steven Rostedt (Google) (cherry picked from commit 4fa4b010b83fb2f837b5ef79e38072a79e96e4f1) --- fs/tracefs/event_inode.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 1c3dd0ad4660..824b1811e342 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -370,6 +370,8 @@ static struct dentry *create_dir(struct eventfs_inode *ei, struct dentry *parent ti = get_tracefs(inode); ti->flags |= TRACEFS_EVENT_INODE; + /* Only directories have ti->private set to an ei, not files */ + ti->private = ei; inc_nlink(inode); d_instantiate(dentry, inode); @@ -515,7 +517,6 @@ create_file_dentry(struct eventfs_inode *ei, int idx, static void eventfs_post_create_dir(struct eventfs_inode *ei) { struct eventfs_inode *ei_child; - struct tracefs_inode *ti; lockdep_assert_held(&eventfs_mutex); @@ -525,9 +526,6 @@ static void eventfs_post_create_dir(struct eventfs_inode *ei) srcu_read_lock_held(&eventfs_srcu)) { ei_child->d_parent = ei->dentry; } - - ti = get_tracefs(ei->dentry->d_inode); - ti->private = ei; } /**