Skip to content

Commit 3b404a5

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull apparmor bugfix from James Morris: "This has a fix for a policy replacement bug that is fairly serious for apache mod_apparmor users, as it results in the wrong policy being applied on an network facing service" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: apparmor: fix change_hat not finding hat after policy replacement
2 parents 8d1a240 + 3d40658 commit 3b404a5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

security/apparmor/domain.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,8 @@ int aa_change_hat(const char *hats[], int count, u64 token, bool permtest)
621621
/* released below */
622622
cred = get_current_cred();
623623
cxt = cred_cxt(cred);
624-
profile = aa_cred_profile(cred);
625-
previous_profile = cxt->previous;
624+
profile = aa_get_newest_profile(aa_cred_profile(cred));
625+
previous_profile = aa_get_newest_profile(cxt->previous);
626626

627627
if (unconfined(profile)) {
628628
info = "unconfined";
@@ -718,6 +718,8 @@ int aa_change_hat(const char *hats[], int count, u64 token, bool permtest)
718718
out:
719719
aa_put_profile(hat);
720720
kfree(name);
721+
aa_put_profile(profile);
722+
aa_put_profile(previous_profile);
721723
put_cred(cred);
722724

723725
return error;

0 commit comments

Comments
 (0)