* [PATCH] fs: tmpfile_create(): add missing mntget()
@ 2026-01-19 9:46 Sascha Hauer
2026-01-19 9:50 ` Sascha Hauer
2026-01-19 12:12 ` Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2026-01-19 9:46 UTC (permalink / raw)
To: Barebox List
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: tmpfile_create(): add missing mntget()
2026-01-19 9:46 [PATCH] fs: tmpfile_create(): add missing mntget() Sascha Hauer
@ 2026-01-19 9:50 ` Sascha Hauer
2026-01-19 12:12 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2026-01-19 9:50 UTC (permalink / raw)
To: Barebox List
On Mon, Jan 19, 2026 at 10:46:17AM +0100, Sascha Hauer wrote:
> 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().
git blame points to:
e5591127b7 ("fs: allocate inodes for O_TMPFILE-created files")
I am not really sure though if the issue was there before the patch.
Sascha
>
> 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
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: tmpfile_create(): add missing mntget()
2026-01-19 9:46 [PATCH] fs: tmpfile_create(): add missing mntget() Sascha Hauer
2026-01-19 9:50 ` Sascha Hauer
@ 2026-01-19 12:12 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2026-01-19 12:12 UTC (permalink / raw)
To: Barebox List, Sascha Hauer
On Mon, 19 Jan 2026 10:46:17 +0100, Sascha Hauer wrote:
> 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().
>
>
Applied, thanks!
[1/1] fs: tmpfile_create(): add missing mntget()
https://git.pengutronix.de/cgit/barebox/commit/?id=4f3aee3f1c60 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-19 12:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-19 9:46 [PATCH] fs: tmpfile_create(): add missing mntget() Sascha Hauer
2026-01-19 9:50 ` Sascha Hauer
2026-01-19 12:12 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox