[PATCH 2/2] fs: unreference path in canonicalize_path()

Sascha Hauer s.hauer at pengutronix.de
Wed Jun 11 04:56:35 PDT 2025


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 at 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




More information about the barebox mailing list