mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
Revert "[PATCH] namespaces: fix exit race by splitting exit"
This reverts commit 7a238fcba0
in
preparation for a better and simpler fix proposed by Eric Biederman
(and fixed up by Serge Hallyn)
Acked-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
8c8c4bafc3
commit
444f378b23
4 changed files with 16 additions and 40 deletions
|
@ -35,30 +35,22 @@ struct nsproxy *dup_namespaces(struct nsproxy *orig);
|
|||
int copy_namespaces(int flags, struct task_struct *tsk);
|
||||
void get_task_namespaces(struct task_struct *tsk);
|
||||
void free_nsproxy(struct nsproxy *ns);
|
||||
struct nsproxy *put_nsproxy(struct nsproxy *ns);
|
||||
|
||||
static inline void finalize_put_nsproxy(struct nsproxy *ns)
|
||||
static inline void put_nsproxy(struct nsproxy *ns)
|
||||
{
|
||||
if (ns)
|
||||
if (atomic_dec_and_test(&ns->count)) {
|
||||
free_nsproxy(ns);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void put_and_finalize_nsproxy(struct nsproxy *ns)
|
||||
static inline void exit_task_namespaces(struct task_struct *p)
|
||||
{
|
||||
finalize_put_nsproxy(put_nsproxy(ns));
|
||||
}
|
||||
|
||||
static inline struct nsproxy *preexit_task_namespaces(struct task_struct *p)
|
||||
{
|
||||
return put_nsproxy(p->nsproxy);
|
||||
}
|
||||
|
||||
static inline void exit_task_namespaces(struct task_struct *p,
|
||||
struct nsproxy *ns)
|
||||
{
|
||||
task_lock(p);
|
||||
p->nsproxy = NULL;
|
||||
task_unlock(p);
|
||||
finalize_put_nsproxy(ns);
|
||||
struct nsproxy *ns = p->nsproxy;
|
||||
if (ns) {
|
||||
task_lock(p);
|
||||
p->nsproxy = NULL;
|
||||
task_unlock(p);
|
||||
put_nsproxy(ns);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue