mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
nstree: drop ns_tree_add_raw()
Now that ns_tree_add() doesn't allocate an id anymore it does the same
thing as ns_tree_add_raw(). Switch the remaining ns_tree_add_raw() users
over to ns_tree_add() and drop it. Rename __ns_tree_add_raw() to
__ns_tree_add() while at it.
No functional changes.
Fixes: f675d2e955 ("lsm: add LSM blob and hooks for namespaces")
Cc: [email protected] # mainline only
Link: https://patch.msgid.link/20261029-work-security-namespace_free-v2-5-65591dbba7b3@kernel.org
Acked-by: Alexei Starovoitov <[email protected]>
Signed-off-by: Christian Brauner (Amutable) <[email protected]>
This commit is contained in:
+2
-2
@@ -3296,7 +3296,7 @@ static struct mnt_namespace *create_new_namespace(struct path *path,
|
||||
}
|
||||
|
||||
new_ns->root = new_ns_root;
|
||||
ns_tree_add_raw(new_ns);
|
||||
ns_tree_add(new_ns);
|
||||
return new_ns;
|
||||
}
|
||||
|
||||
@@ -4497,7 +4497,7 @@ struct mnt_namespace *copy_mnt_ns(u64 flags, struct mnt_namespace *ns,
|
||||
p = next_mnt(skip_mnt_tree(p), old);
|
||||
}
|
||||
}
|
||||
ns_tree_add_raw(new_ns);
|
||||
ns_tree_add(new_ns);
|
||||
return new_ns;
|
||||
}
|
||||
|
||||
|
||||
+2
-11
@@ -42,22 +42,13 @@ void ns_tree_node_del(struct ns_tree_node *node, struct ns_tree_root *root);
|
||||
struct uts_namespace *: &(uts_ns_tree))
|
||||
|
||||
u64 __ns_tree_gen_id(struct ns_common *ns, u64 id);
|
||||
void __ns_tree_add_raw(struct ns_common *ns, struct ns_tree_root *ns_tree);
|
||||
void __ns_tree_add(struct ns_common *ns, struct ns_tree_root *ns_tree);
|
||||
void __ns_tree_remove(struct ns_common *ns, struct ns_tree_root *ns_tree);
|
||||
struct ns_common *ns_tree_lookup_rcu(u64 ns_id, int ns_type);
|
||||
struct ns_common *__ns_tree_adjoined_rcu(struct ns_common *ns,
|
||||
struct ns_tree_root *ns_tree,
|
||||
bool previous);
|
||||
|
||||
/**
|
||||
* ns_tree_add_raw - Add a namespace to a namespace
|
||||
* @__ns: Namespace to add
|
||||
*
|
||||
* This function adds a namespace to the appropriate namespace tree
|
||||
* without assigning a id.
|
||||
*/
|
||||
#define ns_tree_add_raw(__ns) __ns_tree_add_raw(to_ns_common(__ns), to_ns_tree(__ns))
|
||||
|
||||
/**
|
||||
* ns_tree_add - Add a namespace to a namespace tree
|
||||
* @__ns: Namespace to add
|
||||
@@ -65,7 +56,7 @@ struct ns_common *__ns_tree_adjoined_rcu(struct ns_common *ns,
|
||||
* This function adds a namespace to the appropriate namespace tree and
|
||||
* list. The namespace must already have been assigned an id.
|
||||
*/
|
||||
#define ns_tree_add(__ns) __ns_tree_add_raw(to_ns_common(__ns), to_ns_tree(__ns))
|
||||
#define ns_tree_add(__ns) __ns_tree_add(to_ns_common(__ns), to_ns_tree(__ns))
|
||||
|
||||
/**
|
||||
* ns_tree_remove - Remove a namespace from a namespace tree
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
|
||||
|
||||
sem_init_ns(ns);
|
||||
shm_init_ns(ns);
|
||||
ns_tree_add_raw(ns);
|
||||
ns_tree_add(ns);
|
||||
|
||||
return ns;
|
||||
|
||||
|
||||
+1
-1
@@ -194,7 +194,7 @@ static int ns_cmp_owner(struct rb_node *a, const struct rb_node *b)
|
||||
return ns_id_cmp(node_to_ns_owner(a)->ns_id, node_to_ns_owner(b)->ns_id);
|
||||
}
|
||||
|
||||
void __ns_tree_add_raw(struct ns_common *ns, struct ns_tree_root *ns_tree)
|
||||
void __ns_tree_add(struct ns_common *ns, struct ns_tree_root *ns_tree)
|
||||
{
|
||||
struct rb_node *node;
|
||||
const struct proc_ns_operations *ops = ns->ops;
|
||||
|
||||
@@ -449,7 +449,7 @@ static __net_init int setup_net(struct net *net)
|
||||
up_write(&net_rwsem);
|
||||
/* Without CONFIG_NET_NS init_net isn't exposed as a namespace. */
|
||||
if (IS_ENABLED(CONFIG_NET_NS))
|
||||
ns_tree_add_raw(net);
|
||||
ns_tree_add(net);
|
||||
out:
|
||||
return error;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user