From nobody Wed Dec 31 16:19:43 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 914D2C4332F for ; Tue, 31 Oct 2023 16:42:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345196AbjJaQm6 (ORCPT ); Tue, 31 Oct 2023 12:42:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231540AbjJaQml (ORCPT ); Tue, 31 Oct 2023 12:42:41 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3020137 for ; Tue, 31 Oct 2023 09:42:31 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3F57C433C7; Tue, 31 Oct 2023 16:42:30 +0000 (UTC) Date: Tue, 31 Oct 2023 12:42:29 -0400 From: Steven Rostedt To: LKML , Linux Trace Kernel Cc: Masami Hiramatsu , Mark Rutland Subject: [PATCH] eventfs: Remove extra dget() in eventfs_create_events_dir() Message-ID: <20231031124229.4f2e3fa1@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Steven Rostedt (Google)" 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(). Fixes: 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_in= ode") Signed-off-by: Steven Rostedt (Google) --- 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 ae2172814bdc..d051b889147d 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -952,9 +952,6 @@ struct eventfs_inode *eventfs_create_events_dir(const c= har *name, struct dentry fsnotify_mkdir(dentry->d_parent->d_inode, dentry); tracefs_end_creating(dentry); =20 - /* Will call dput when the directory is removed */ - dget(dentry); - return ei; =20 fail: --=20 2.42.0