From patchwork Tue Feb 6 12:09:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 197392 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1497201dyb; Tue, 6 Feb 2024 04:19:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFyjCZzlbhtqBSVml7g5qKf0IDXIbwVPGaeZ0gKVi7QpMUefJ9jBo9KeH1s37oJSlks65nm X-Received: by 2002:a05:6902:4ec:b0:dbc:b14f:9064 with SMTP id w12-20020a05690204ec00b00dbcb14f9064mr1399383ybs.46.1707221977381; Tue, 06 Feb 2024 04:19:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707221977; cv=pass; d=google.com; s=arc-20160816; b=04I+w6u9MZnH12d0K2NxFfYE+y/clBxGWkWZ4t3Uzl4pQzhLP0sdfIFGGYbtJIHqCr 06Lutc+RNThnFHf3H2JAIku12S7VM7Yv/GlWOhbQRNFVeHKiTaOVCpIc6c1N3L4zD2mw HmQpF/33iPxF2PbOBRcunBBcs2TQoOJvNQWrJePQ0wLlqhdTfOKN4/Mc07cPOYCouug5 5FXtUEnUcDMJdCoVu7wJ+lkOxUV/bGu1pOyeiwcOVX197GfEnzJPb+6H9oRj5YbY3VnB JIN1Pp5+X5yVU28+J+ih7jRtXct7wbO3dXunqDpu7JA8HSbRU2+iU+xMCRu9hdS6XEzn g3QA== 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=V/yf1Ww67fwH3Ww0NQfTCIKnyTvOEfzyJ0HNZ9lmEs4=; fh=5iuWqqZCWvXcryQAl4Sshfa5ySGPhLHFMZQ6AZBXA44=; b=XObOxL7MbWoaG78Dd3ihBH+3CRZQkh9yJ7Il61Yf+DtYVORrullla+kEbZlb20vCxT MC6qF22JPFrUT/htqVWyYjSiWopRhHgsydf+vSSAe4JaeGr32Hs7uRywk1EGpPjJ2tpL 8H5XziEon7lOyi2ng5cdfNXB68AFrRGgYHIDnikdIJAxBXbMjDfihn3YS4WfMxFeeWeP zoThCX0Fzs0ARTYzqqTJgGre68ynYfQnmBENeJRCM7I/n+t1i2569kq6VG+IuLmVXKjy daLm5opjeKAfeej/+27if7eq6hwll/COEuqBk10yWAPt7iMC3hAvAKgo2UnhCO68m21X a9qQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54889-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54889-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUKa/nwaYPRQDsiuCsTej5awZ/MUlJ3f/Cd3+DzYmImJhG9jQpkwztJMbE96kcTidJp7D2btx7wLV62XJk9KynONMUNzQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id kd26-20020a056214401a00b006819bba47f3si2551945qvb.508.2024.02.06.04.19.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 04:19:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54889-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54889-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54889-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 209F91C23D4A for ; Tue, 6 Feb 2024 12:19:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A03113BE92; Tue, 6 Feb 2024 12:09:27 +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 9F578135A63; Tue, 6 Feb 2024 12:09:20 +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=1707221360; cv=none; b=r/GBtCUpQTH52YlMUA95X8HvDjO59M0/CrH6kY4OLT7H8RjGpj/7cwANAjmMINEZI6e8K9ZZOh3lDcl3RYvqUnMT+u9ayUIZR9CWK9xfK5i31sbtBAQ/xchTc7yXnldEBHbP2OCxXaDS92T3SBRnpMr9dBs0Z5/PEuIB145lVR8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707221360; c=relaxed/simple; bh=2aaBsNBmdbcGzMEkSucJzBcIVM88W8uW7E3nMS6OFqQ=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Dj/wrbXEOKn/wCSF2BTOyb0y2PCi8vVPQtN6vz8FiD83HP9uZaGiLqyK/rvr8USV8OopD0VAhkWa2tytP45kjYDr+stlluwUPqV4KfXj5QYERIGTfCfHu6CtHF2pMnpxJ9Xz9ev89j1/+FvoUQ6DMEloJ7fsrvTt5KOS62tuYfg= 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 534CDC433B2; Tue, 6 Feb 2024 12:09:20 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rXKGq-00000006b8K-3L6D; Tue, 06 Feb 2024 07:09:48 -0500 Message-ID: <20240206120948.657072999@rostedt.homelinux.com> User-Agent: quilt/0.67 Date: Tue, 06 Feb 2024 07:09:19 -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 Subject: [v6.6][PATCH 14/57] eventfs: Remove extra dget() in eventfs_create_events_dir() 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790151991978610536 X-GMAIL-MSGID: 1790151991978610536 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(). Link: https://lore.kernel.org/linux-trace-kernel/20231031124229.4f2e3fa1@gandalf.local.home Cc: Masami Hiramatsu Cc: Mark Rutland Fixes: 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode") Signed-off-by: Steven Rostedt (Google) (cherry picked from commit 77bc4d4921bd3497678ba8e7f4e480de35692f05) --- 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: