Skip to content

Commit 229fd15

Browse files
committed
fs: don't try and remove empty rbtree node
When copying a namespace we won't have added the new copy into the namespace rbtree until after the copy succeeded. Calling free_mnt_ns() will try to remove the copy from the rbtree which is invalid. Simply free the namespace skeleton directly. Link: https://lore.kernel.org/r/20241016-adapter-seilwinde-83c508a7bde1@brauner Fixes: 1901c92 ("fs: keep an index of current mount namespaces") Tested-by: Brad Spengler <spender@grsecurity.net> Cc: stable@vger.kernel.org # v6.11+ Reported-by: Brad Spengler <spender@grsecurity.net> Suggested-by: Brad Spengler <spender@grsecurity.net> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent d6a7766 commit 229fd15

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

fs/namespace.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3944,7 +3944,9 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
39443944
new = copy_tree(old, old->mnt.mnt_root, copy_flags);
39453945
if (IS_ERR(new)) {
39463946
namespace_unlock();
3947-
free_mnt_ns(new_ns);
3947+
ns_free_inum(&new_ns->ns);
3948+
dec_mnt_namespaces(new_ns->ucounts);
3949+
mnt_ns_release(new_ns);
39483950
return ERR_CAST(new);
39493951
}
39503952
if (user_ns != ns->user_ns) {

0 commit comments

Comments
 (0)