From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH 3/4] fs: kill invalid dentries
Date: Thu, 07 Nov 2024 08:23:32 +0100 [thread overview]
Message-ID: <20241107-fs-tftp-v1-3-39d7e1cff418@pengutronix.de> (raw)
In-Reply-To: <20241107-fs-tftp-v1-0-39d7e1cff418@pengutronix.de>
When a dentry becomes invalid we can safely kill it and free the
associated memory. This fixes a memory leakage in the tftp and nfs
code as these regularly declare a dentry as invalid.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/fs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/fs.c b/fs/fs.c
index f24962d2a6..a9d2cc7088 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1577,6 +1577,7 @@ static struct dentry *lookup_dcache(const struct qstr *name,
if (!error)
d_invalidate(dentry);
dput(dentry);
+ dentry_kill(dentry);
return ERR_PTR(error);
}
}
--
2.39.5
next prev parent reply other threads:[~2024-11-07 8:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 7:23 [PATCH 0/4] some fs/tftp updates Sascha Hauer
2024-11-07 7:23 ` [PATCH 1/4] fs: open loopback device before using it Sascha Hauer
2024-11-07 7:23 ` [PATCH 2/4] fs: tftp: cache dentries for some time Sascha Hauer
2024-11-07 7:23 ` Sascha Hauer [this message]
2024-11-07 7:23 ` [PATCH 4/4] fs: tftp: Set default window size to 1 Sascha Hauer
2024-11-08 13:26 ` [PATCH 0/4] some fs/tftp updates Sascha Hauer
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=20241107-fs-tftp-v1-3-39d7e1cff418@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.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