Commit b2118ea97113de62ca5e19c1d92cf9c2966c45e8

Authored by Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security

Pull apparmor fixes from James Morris:
 "A couple more regressions fixed"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
  apparmor: fix bad lock balance when introspecting policy
  apparmor: fix memleak of the profile hash

Showing 2 changed files Side-by-side Diff

security/apparmor/apparmorfs.c
... ... @@ -580,15 +580,13 @@
580 580  
581 581 /* check if the next ns is a sibling, parent, gp, .. */
582 582 parent = ns->parent;
583   - while (parent) {
  583 + while (ns != root) {
584 584 mutex_unlock(&ns->lock);
585 585 next = list_entry_next(ns, base.list);
586 586 if (!list_entry_is_head(next, &parent->sub_ns, base.list)) {
587 587 mutex_lock(&next->lock);
588 588 return next;
589 589 }
590   - if (parent == root)
591   - return NULL;
592 590 ns = parent;
593 591 parent = parent->parent;
594 592 }
security/apparmor/policy.c
... ... @@ -610,6 +610,7 @@
610 610 aa_put_dfa(profile->policy.dfa);
611 611 aa_put_replacedby(profile->replacedby);
612 612  
  613 + kzfree(profile->hash);
613 614 kzfree(profile);
614 615 }
615 616