Patchwork [1/2] UBUNTU: SAUCE: AppArmor: Set error code after structure initialization.

login
register
mail settings
Submitter John Johansen
Date Oct. 8, 2009, 8:45 p.m.
Message ID <1255034711-11623-2-git-send-email-john.johansen@canonical.com>
Download mbox | patch
Permalink /patch/35528/
State Accepted
Headers show

Comments

John Johansen - Oct. 8, 2009, 8:45 p.m.
BugLink: http://bugs.launchpad.net/bugs/427948

The net audit structure error field was being set before the audit
structure was cleared.  Move the assignment to after the audit
structure is cleared.

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

Patch

diff --git a/ubuntu/apparmor/net.c b/ubuntu/apparmor/net.c
index b236d14..20f921b 100644
--- a/ubuntu/apparmor/net.c
+++ b/ubuntu/apparmor/net.c
@@ -110,9 +110,8 @@  int aa_net_perm(struct aa_profile *profile, char *operation,
 
 	family_mask = profile->net.allowed[family];
 
-	sa.base.error = (family_mask & (1 << type)) ? 0 : -EACCES;
-
 	memset(&sa, 0, sizeof(sa));
+	sa.base.error = (family_mask & (1 << type)) ? 0 : -EACCES;
 	sa.base.operation = operation;
 	sa.base.gfp_mask = GFP_KERNEL;
 	sa.family = family;