]> www.infradead.org Git - users/hch/misc.git/commitdiff
fs/namespace.c: allow to drop vfsmount references via __free(mntput)
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 23 Aug 2025 06:06:57 +0000 (02:06 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 2 Sep 2025 23:35:56 +0000 (19:35 -0400)
Note that just as path_put, it should never be done in scope of
namespace_sem, be it shared or exclusive.

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namespace.c

index fcea65587ff9146ae296eaa72d2f9cbccf375abd..767ab751ee2a392f51cd7a757144a854d1fb7aae 100644 (file)
@@ -88,6 +88,8 @@ DEFINE_LOCK_GUARD_0(namespace_excl, namespace_lock(), namespace_unlock())
 DEFINE_LOCK_GUARD_0(namespace_shared, down_read(&namespace_sem),
                                      up_read(&namespace_sem))
 
+DEFINE_FREE(mntput, struct vfsmount *, if (!IS_ERR(_T)) mntput(_T))
+
 #ifdef CONFIG_FSNOTIFY
 LIST_HEAD(notify_list); /* protected by namespace_sem */
 #endif