diff options
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 521591dbab2f..1bf4d6db54ab 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -2597,7 +2597,8 @@ static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp, | |||
2597 | { | 2597 | { |
2598 | struct cgroup_pidlist *l; | 2598 | struct cgroup_pidlist *l; |
2599 | /* don't need task_nsproxy() if we're looking at ourself */ | 2599 | /* don't need task_nsproxy() if we're looking at ourself */ |
2600 | struct pid_namespace *ns = get_pid_ns(current->nsproxy->pid_ns); | 2600 | struct pid_namespace *ns = current->nsproxy->pid_ns; |
2601 | |||
2601 | /* | 2602 | /* |
2602 | * We can't drop the pidlist_mutex before taking the l->mutex in case | 2603 | * We can't drop the pidlist_mutex before taking the l->mutex in case |
2603 | * the last ref-holder is trying to remove l from the list at the same | 2604 | * the last ref-holder is trying to remove l from the list at the same |
@@ -2607,8 +2608,6 @@ static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp, | |||
2607 | mutex_lock(&cgrp->pidlist_mutex); | 2608 | mutex_lock(&cgrp->pidlist_mutex); |
2608 | list_for_each_entry(l, &cgrp->pidlists, links) { | 2609 | list_for_each_entry(l, &cgrp->pidlists, links) { |
2609 | if (l->key.type == type && l->key.ns == ns) { | 2610 | if (l->key.type == type && l->key.ns == ns) { |
2610 | /* found a matching list - drop the extra refcount */ | ||
2611 | put_pid_ns(ns); | ||
2612 | /* make sure l doesn't vanish out from under us */ | 2611 | /* make sure l doesn't vanish out from under us */ |
2613 | down_write(&l->mutex); | 2612 | down_write(&l->mutex); |
2614 | mutex_unlock(&cgrp->pidlist_mutex); | 2613 | mutex_unlock(&cgrp->pidlist_mutex); |
@@ -2619,13 +2618,12 @@ static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp, | |||
2619 | l = kmalloc(sizeof(struct cgroup_pidlist), GFP_KERNEL); | 2618 | l = kmalloc(sizeof(struct cgroup_pidlist), GFP_KERNEL); |
2620 | if (!l) { | 2619 | if (!l) { |
2621 | mutex_unlock(&cgrp->pidlist_mutex); | 2620 | mutex_unlock(&cgrp->pidlist_mutex); |
2622 | put_pid_ns(ns); | ||
2623 | return l; | 2621 | return l; |
2624 | } | 2622 | } |
2625 | init_rwsem(&l->mutex); | 2623 | init_rwsem(&l->mutex); |
2626 | down_write(&l->mutex); | 2624 | down_write(&l->mutex); |
2627 | l->key.type = type; | 2625 | l->key.type = type; |
2628 | l->key.ns = ns; | 2626 | l->key.ns = get_pid_ns(ns); |
2629 | l->use_count = 0; /* don't increment here */ | 2627 | l->use_count = 0; /* don't increment here */ |
2630 | l->list = NULL; | 2628 | l->list = NULL; |
2631 | l->owner = cgrp; | 2629 | l->owner = cgrp; |