Commit c7ec845f authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'pid-introduce-helper-task_is_in_root_ns'

Leo Yan says:

====================
pid: Introduce helper task_is_in_root_ns()

This patch series introduces a helper function task_is_in_init_pid_ns()
to replace open code.  The two patches are extracted from the original
series [1] for network subsystem.

As a plan, we can firstly land this patch set into kernel 5.18; there
have 5 patches are left out from original series [1], as a next step,
I will resend them for appropriate linux-next merging.

[1] https://lore.kernel.org/lkml/20211208083320.472503-1-leo.yan@linaro.org/
====================

Link: https://lore.kernel.org/r/20220126050427.605628-1-leo.yan@linaro.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents a92f7a6f 42c66d16
......@@ -358,7 +358,7 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
* other namespaces.
*/
if ((current_user_ns() != &init_user_ns) ||
(task_active_pid_ns(current) != &init_pid_ns))
!task_is_in_init_pid_ns(current))
return;
/* Can only change if privileged. */
......
......@@ -86,4 +86,9 @@ extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk);
void pidhash_init(void);
void pid_idr_init(void);
static inline bool task_is_in_init_pid_ns(struct task_struct *tsk)
{
return task_active_pid_ns(tsk) == &init_pid_ns;
}
#endif /* _LINUX_PID_NS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment