Patchwork [2/4] UBUNTU: SAUCE: Fix Oops when in apparmor_bprm_set_creds

login
register
mail settings
Submitter John Johansen
Date Nov. 9, 2009, 8:41 p.m.
Message ID <1257799316-12573-3-git-send-email-john.johansen@canonical.com>
Download mbox | patch
Permalink /patch/38035/
State Superseded
Headers show

Comments

John Johansen - Nov. 9, 2009, 8:41 p.m.
BugLink: http://bugs.launchpad.net/bugs/446164

If name resolution fails due on exec and a profile is not defined
then AppArmor will cause an oops due to a broken conditional leading to
dereferencing a profile pointer that is null.

Signed-off-by: John Johansen <john.johansen@canonical.com>
---
 ubuntu/apparmor/domain.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/ubuntu/apparmor/domain.c b/ubuntu/apparmor/domain.c
index aa25be2..0594ea2 100644
--- a/ubuntu/apparmor/domain.c
+++ b/ubuntu/apparmor/domain.c
@@ -248,7 +248,7 @@  int apparmor_bprm_set_creds(struct linux_binprm *bprm)
 	sa.base.error = aa_get_name(&bprm->file->f_path, 0, &buffer,
 				    (char **) &sa.name);
 	if (sa.base.error) {
-		if (profile || profile->flags & PFLAG_IX_ON_NAME_ERROR)
+		if (profile && profile->flags & PFLAG_IX_ON_NAME_ERROR)
 			sa.base.error = 0;
 		sa.base.info = "Exec failed name resolution";
 		sa.name = bprm->filename;