Skip to content

Commit 7bb4c85

Browse files
author
Al Viro
committed
copy_mnt_ns(): use the regular mechanism for freeing empty mnt_ns on failure
Now that free_mnt_ns() works prior to mnt_ns_tree_add(), there's no need for an open-coded analogue free_mnt_ns() there - yes, we do avoid one call_rcu() use per failing call of clone() or unshare(), if they fail due to OOM in that particular spot, but it's not really worth bothering. Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 1b966c4 commit 7bb4c85

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

fs/namespace.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4184,10 +4184,8 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
41844184
copy_flags |= CL_SLAVE;
41854185
new = copy_tree(old, old->mnt.mnt_root, copy_flags);
41864186
if (IS_ERR(new)) {
4187+
emptied_ns = new_ns;
41874188
namespace_unlock();
4188-
ns_free_inum(&new_ns->ns);
4189-
dec_mnt_namespaces(new_ns->ucounts);
4190-
mnt_ns_release(new_ns);
41914189
return ERR_CAST(new);
41924190
}
41934191
if (user_ns != ns->user_ns) {

0 commit comments

Comments
 (0)