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 2/2] fs: unreference path in canonicalize_path()
Date: Wed, 11 Jun 2025 13:56:35 +0200	[thread overview]
Message-ID: <20250611115635.3341350-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20250611115635.3341350-1-s.hauer@pengutronix.de>

canonicalize_path() missed to unreference the path after usage, so the
filesystem containing *pathname can't be unmounted anymore. This happens
for example on a 'findmnt /mnt/mmc2.1' after which /mnt/mmc2.1 cannot be
unmounted.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/fs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index 18343552a7..8689e14e68 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -2996,6 +2996,8 @@ char *canonicalize_path(int dirfd, const char *pathname)
 		goto out;
 
 	res = dpath(path.dentry, d_root);
+
+	path_put(&path);
 out:
 	errno_set(ret);
 	return res;
-- 
2.39.5




  reply	other threads:[~2025-06-11 15:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-11 11:56 [PATCH 1/2] fs: unreference path on file close Sascha Hauer
2025-06-11 11:56 ` Sascha Hauer [this message]
2025-06-12  7:39 ` 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=20250611115635.3341350-2-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