]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
take freeing of emptied mnt_namespace to namespace_unlock()
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 18 Jun 2025 22:23:41 +0000 (18:23 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 29 Jun 2025 23:03:46 +0000 (19:03 -0400)
commitaab771f34e63ef89e195b63d121abcb55eebfde6
tree1b0cce428051480373090d0a8d8eb7bc9d6af5d6
parent663206854f020ec6fc6bfd3d52f501a28ede1403
take freeing of emptied mnt_namespace to namespace_unlock()

Freeing of a namespace must be delayed until after we'd dealt with mount
notifications (in namespace_unlock()).  The reasons are not immediately
obvious (they are buried in ->prev_ns handling in mnt_notify()), and
having that free_mnt_ns() explicitly called after namespace_unlock()
is asking for trouble - it does feel like they should be OK to free
as soon as they've been emptied.

Make the things more explicit by setting 'emptied_ns' under namespace_sem
and having namespace_unlock() free the sucker as soon as it's safe to free.

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