mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [for-next][PATCH 02/12] eventfs: Remove extra dget() in eventfs_create_events_dir()
Date: Wed, 01 Nov 2023 17:37:20 -0400	[thread overview]
Message-ID: <20231101213802.017038744@goodmis.org> (raw)
In-Reply-To: <20231101213718.381015321@goodmis.org>

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The creation of the top events directory does a dget() at the end of the
creation in eventfs_create_events_dir() with a comment saying the final
dput() will happen when it is removed. The problem is that a dget() is
already done on the dentry when it was created with tracefs_start_creating()!
The dget() now just causes a memory leak of that dentry.

Remove the extra dget() as the final dput() in the deletion of the events
directory actually matches the one in tracefs_start_creating().

Link: https://lore.kernel.org/linux-trace-kernel/20231031124229.4f2e3fa1@gandalf.local.home

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Fixes: 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 fs/tracefs/event_inode.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index 4d2da7480e5f..5536860eb2ff 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -774,9 +774,6 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
 	fsnotify_mkdir(dentry->d_parent->d_inode, dentry);
 	tracefs_end_creating(dentry);
 
-	/* Will call dput when the directory is removed */
-	dget(dentry);
-
 	return ei;
 
  fail:
-- 
2.42.0

  parent reply	other threads:[~2023-11-01 21:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01 21:37 [for-next][PATCH 00/12] tracing: Final (hopefully!) updates for v6.7 Steven Rostedt
2023-11-01 21:37 ` [for-next][PATCH 01/12] tracing: Have trace_event_file have ref counters Steven Rostedt
2023-11-01 21:37 ` Steven Rostedt [this message]
2023-11-01 21:37 ` [for-next][PATCH 03/12] tracing: Have the user copy of synthetic event address use correct context Steven Rostedt
2023-11-01 21:37 ` [for-next][PATCH 04/12] eventfs: Fix kerneldoc of eventfs_remove_rec() Steven Rostedt
2023-11-01 21:37 ` [for-next][PATCH 05/12] eventfs: Remove "is_freed" union with rcu head Steven Rostedt
2023-11-01 21:37 ` [for-next][PATCH 06/12] eventfs: Have a free_ei() that just frees the eventfs_inode Steven Rostedt
2023-11-01 21:37 ` [for-next][PATCH 07/12] eventfs: Test for ei->is_freed when accessing ei->dentry Steven Rostedt
2023-11-01 21:37 ` [for-next][PATCH 08/12] eventfs: Save ownership and mode Steven Rostedt
2023-11-01 21:37 ` [for-next][PATCH 09/12] eventfs: Hold eventfs_mutex when calling callback functions Steven Rostedt
2023-11-01 21:37 ` [for-next][PATCH 10/12] eventfs: Delete eventfs_inode when the last dentry is freed Steven Rostedt
2023-11-01 21:37 ` [for-next][PATCH 11/12] eventfs: Remove special processing of dput() of events directory Steven Rostedt
2023-11-01 21:37 ` [for-next][PATCH 12/12] eventfs: Use simple_recursive_removal() to clean up dentries Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231101213802.017038744@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®