diff options
Diffstat (limited to 'security/apparmor/apparmorfs.c')
-rw-r--r-- | security/apparmor/apparmorfs.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index 95c2b2689a03..7db9954f1af2 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c | |||
@@ -580,15 +580,13 @@ static struct aa_namespace *__next_namespace(struct aa_namespace *root, | |||
580 | 580 | ||
581 | /* check if the next ns is a sibling, parent, gp, .. */ | 581 | /* check if the next ns is a sibling, parent, gp, .. */ |
582 | parent = ns->parent; | 582 | parent = ns->parent; |
583 | while (parent) { | 583 | while (ns != root) { |
584 | mutex_unlock(&ns->lock); | 584 | mutex_unlock(&ns->lock); |
585 | next = list_entry_next(ns, base.list); | 585 | next = list_entry_next(ns, base.list); |
586 | if (!list_entry_is_head(next, &parent->sub_ns, base.list)) { | 586 | if (!list_entry_is_head(next, &parent->sub_ns, base.list)) { |
587 | mutex_lock(&next->lock); | 587 | mutex_lock(&next->lock); |
588 | return next; | 588 | return next; |
589 | } | 589 | } |
590 | if (parent == root) | ||
591 | return NULL; | ||
592 | ns = parent; | 590 | ns = parent; |
593 | parent = parent->parent; | 591 | parent = parent->parent; |
594 | } | 592 | } |