From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Karan Tilak Kumar <kartilak@cisco.com>,
Sesidhar Baddela <sebaddel@cisco.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.15 421/567] scsi: snic: Fix memory leak with using debugfs_lookup()
Date: Tue, 7 Mar 2023 18:02:37 +0100 [thread overview]
Message-ID: <20230307165924.126363478@linuxfoundation.org> (raw)
In-Reply-To: <20230307165905.838066027@linuxfoundation.org>
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Upstream commit ad0e4e2fab928477f74d742e6e77d79245d3d3e7 ]
When calling debugfs_lookup() the result must have dput() called on it,
otherwise the memory will leak over time. To make things simpler, just
call debugfs_lookup_and_remove() instead which handles all of the logic at
once.
Link: https://lore.kernel.org/r/20230202141009.2290380-1-gregkh@linuxfoundation.org
Cc: Karan Tilak Kumar <kartilak@cisco.com>
Cc: Sesidhar Baddela <sebaddel@cisco.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/snic/snic_debugfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/snic/snic_debugfs.c b/drivers/scsi/snic/snic_debugfs.c
index 5e0faeba516e5..76baa4f9a06e3 100644
--- a/drivers/scsi/snic/snic_debugfs.c
+++ b/drivers/scsi/snic/snic_debugfs.c
@@ -451,6 +451,6 @@ void snic_trc_debugfs_init(void)
void
snic_trc_debugfs_term(void)
{
- debugfs_remove(debugfs_lookup(TRC_FILE, snic_glob->trc_root));
- debugfs_remove(debugfs_lookup(TRC_ENABLE_FILE, snic_glob->trc_root));
+ debugfs_lookup_and_remove(TRC_FILE, snic_glob->trc_root);
+ debugfs_lookup_and_remove(TRC_ENABLE_FILE, snic_glob->trc_root);
}
--
2.39.2
next prev parent reply other threads:[~2023-03-07 19:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 16:55 [PATCH 5.15 000/567] 5.15.99-rc1 review Greg Kroah-Hartman
2023-03-07 16:57 ` [PATCH 5.15 122/567] crypto: ccp - Refactor out sev_fw_alloc() Greg Kroah-Hartman
2023-03-07 17:01 ` [PATCH 5.15 368/567] trace/blktrace: fix memory leak with using debugfs_lookup() Greg Kroah-Hartman
2023-03-07 17:02 ` Greg Kroah-Hartman [this message]
2023-03-07 17:03 ` [PATCH 5.15 468/567] KVM: SVM: Fix potential overflow in SEVs send|receive_update_data() Greg Kroah-Hartman
2023-03-07 20:02 ` [PATCH 5.15 000/567] 5.15.99-rc1 review Harshit Mogalapalli
2023-03-07 20:12 ` Vegard Nossum
2023-03-08 7:19 ` Greg Kroah-Hartman
2023-03-07 23:06 ` Daniel Díaz
2023-03-08 7:19 ` Greg Kroah-Hartman
2023-03-08 4:19 ` Bagas Sanjaya
2023-03-08 6:24 ` Daniel Díaz
2023-03-12 13:57 ` Linux regression tracking (Thorsten Leemhuis)
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=20230307165924.126363478@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=jejb@linux.ibm.com \
--cc=kartilak@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=patches@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=sebaddel@cisco.com \
--cc=stable@vger.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