mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 22:24:11 +08:00
namespace: make timens_on_fork() return nothing
timens_on_fork() always return 0, and maybe not need to judge the return value in copy_namespaces(). So make timens_on_fork() return nothing and do not judge its return val in copy_namespaces(). Signed-off-by: Hui Su <sh_def@163.com> Link: https://lore.kernel.org/r/20201117161750.GA45121@rlk Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
716e343f01
commit
5c62634fc6
@ -45,7 +45,7 @@ struct time_namespace *copy_time_ns(unsigned long flags,
|
||||
struct user_namespace *user_ns,
|
||||
struct time_namespace *old_ns);
|
||||
void free_time_ns(struct kref *kref);
|
||||
int timens_on_fork(struct nsproxy *nsproxy, struct task_struct *tsk);
|
||||
void timens_on_fork(struct nsproxy *nsproxy, struct task_struct *tsk);
|
||||
struct vdso_data *arch_get_vdso_data(void *vvar_page);
|
||||
|
||||
static inline void put_time_ns(struct time_namespace *ns)
|
||||
@ -136,10 +136,10 @@ struct time_namespace *copy_time_ns(unsigned long flags,
|
||||
return old_ns;
|
||||
}
|
||||
|
||||
static inline int timens_on_fork(struct nsproxy *nsproxy,
|
||||
static inline void timens_on_fork(struct nsproxy *nsproxy,
|
||||
struct task_struct *tsk)
|
||||
{
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
static inline void timens_add_monotonic(struct timespec64 *ts) { }
|
||||
|
@ -153,7 +153,6 @@ int copy_namespaces(unsigned long flags, struct task_struct *tsk)
|
||||
struct nsproxy *old_ns = tsk->nsproxy;
|
||||
struct user_namespace *user_ns = task_cred_xxx(tsk, user_ns);
|
||||
struct nsproxy *new_ns;
|
||||
int ret;
|
||||
|
||||
if (likely(!(flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC |
|
||||
CLONE_NEWPID | CLONE_NEWNET |
|
||||
@ -180,11 +179,7 @@ int copy_namespaces(unsigned long flags, struct task_struct *tsk)
|
||||
if (IS_ERR(new_ns))
|
||||
return PTR_ERR(new_ns);
|
||||
|
||||
ret = timens_on_fork(new_ns, tsk);
|
||||
if (ret) {
|
||||
free_nsproxy(new_ns);
|
||||
return ret;
|
||||
}
|
||||
timens_on_fork(new_ns, tsk);
|
||||
|
||||
tsk->nsproxy = new_ns;
|
||||
return 0;
|
||||
|
@ -308,22 +308,20 @@ static int timens_install(struct nsset *nsset, struct ns_common *new)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int timens_on_fork(struct nsproxy *nsproxy, struct task_struct *tsk)
|
||||
void timens_on_fork(struct nsproxy *nsproxy, struct task_struct *tsk)
|
||||
{
|
||||
struct ns_common *nsc = &nsproxy->time_ns_for_children->ns;
|
||||
struct time_namespace *ns = to_time_ns(nsc);
|
||||
|
||||
/* create_new_namespaces() already incremented the ref counter */
|
||||
if (nsproxy->time_ns == nsproxy->time_ns_for_children)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
get_time_ns(ns);
|
||||
put_time_ns(nsproxy->time_ns);
|
||||
nsproxy->time_ns = ns;
|
||||
|
||||
timens_commit(tsk, ns);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct user_namespace *timens_owner(struct ns_common *ns)
|
||||
|
Loading…
Reference in New Issue
Block a user