]> git.hungrycats.org Git - linux/commit
fs: don't try and remove empty rbtree node
authorChristian Brauner <brauner@kernel.org>
Wed, 16 Oct 2024 17:49:48 +0000 (19:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Nov 2024 01:02:41 +0000 (02:02 +0100)
commita8b155a2c30dc9a5ba837aa5fcba9a47cc031a9b
treed6f67c95e75b5df12b07fbf9f25e03c3219d7e72
parentc6f58ff2d4c552927fe9a187774e668ebba6c7aa
fs: don't try and remove empty rbtree node

commit 229fd15908fe1f99b1de4cde3326e62d1e892611 upstream.

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: 1901c92497bd ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/namespace.c