mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] fs: tmpfile_create(): add missing mntget()
Date: Mon, 19 Jan 2026 10:46:17 +0100	[thread overview]
Message-ID: <20260119094617.891594-1-s.hauer@pengutronix.de> (raw)

tmpfile_create() assigns the parentpath->mnt to the new file's path
without mntget() it, so we'll get unbalanced reference count when
the tmpfile is closed. Add the missing mntget().

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 75fd3a3ef9..43840c3a7a 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -2675,6 +2675,7 @@ static struct file *tmpfile_create(const struct path *parentpath,
 	if (!f)
 		return ERR_PTR(-EMFILE);
 
+	mntget(parentpath->mnt);
 	f->f_path.mnt = parentpath->mnt;
 	f->f_path.dentry = d_alloc_anon(&fsdev->sb);
 	f->f_flags = flags;
-- 
2.47.3




             reply	other threads:[~2026-01-19  9:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-19  9:46 Sascha Hauer [this message]
2026-01-19  9:50 ` Sascha Hauer
2026-01-19 12:12 ` 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=20260119094617.891594-1-s.hauer@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