]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
userns and mnt_idmap leak in open_tree_attr(2)
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 24 Jun 2025 14:25:04 +0000 (10:25 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 24 Jun 2025 14:25:04 +0000 (10:25 -0400)
commit0748e553df0225754c316a92af3a77fdc057b358
tree5344ea758d9a9fa9e3464d205e8567fba08c2e11
parentce7df19686530920f2f6b636e71ce5eb1d9303ef
userns and mnt_idmap leak in open_tree_attr(2)

Once want_mount_setattr() has returned a positive, it does require
finish_mount_kattr() to release ->mnt_userns.  Failing do_mount_setattr()
does not change that.

As the result, we can end up leaking userns and possibly mnt_idmap as
well.

Fixes: c4a16820d901 ("fs: add open_tree_attr()")
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namespace.c