diff mbox

[trusty] UBUNTU: SAUCE: (no-up) apparmor: fix backtrace on non-smp, kernels.

Message ID 529F082E.90300@canonical.com
State New
Headers show

Commit Message

John Johansen Dec. 4, 2013, 10:47 a.m. UTC
This fixes an AA_BUG assert that is in the non-upstream apparmor 3 alpha4
snapshot.

BugLink: http://bugs.launchpad.net/bugs/1253707

The rw_lock macro write_can_lock as defined can not be properly used in
non-smp kernels. Wrap it in macro that handles smp and carries the
semantic of what is being tested.

Signed-off-by: John Johansen <john.johansen@canonical.com>
---
 security/apparmor/label.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Andy Whitcroft Dec. 4, 2013, 12:37 p.m. UTC | #1
Applied to Trusty.

-apw
diff mbox

Patch

diff --git a/security/apparmor/label.c b/security/apparmor/label.c
index 788ec21..e11be75 100644
--- a/security/apparmor/label.c
+++ b/security/apparmor/label.c
@@ -19,6 +19,11 @@ 
 #include "include/policy.h"
 #include "include/sid.h"
 
+#if defined(CONFIG_SMP)
+#define smp_write_can_lock(X) write_can_lock(X)
+#else
+#define smp_write_can_lock(X) 0
+#endif
 
 /*
  * the aa_label represents the set of profiles confining an object
@@ -223,7 +228,7 @@  static bool __aa_label_remove(struct aa_labelset *ls, struct aa_label *label)
 {
 	AA_BUG(!ls);
 	AA_BUG(!label);
-	AA_BUG(write_can_lock(&ls->lock));
+	AA_BUG(smp_write_can_lock(&ls->lock));
 	AA_BUG(labels_set(label) != ls);
 
 	if (label_invalid(label))
@@ -267,7 +272,7 @@  static bool __aa_label_replace(struct aa_labelset *ls, struct aa_label *old,
 	AA_BUG(!ls);
 	AA_BUG(!old);
 	AA_BUG(!new);
-	AA_BUG(write_can_lock(&ls->lock));
+	AA_BUG(smp_write_can_lock(&ls->lock));
 	AA_BUG(labels_set(old) != ls);
 	AA_BUG(new->flags & FLAG_IN_TREE);
 
@@ -472,7 +477,7 @@  static struct aa_label *__aa_label_insert(struct aa_labelset *ls,
 
 	AA_BUG(!ls);
 	AA_BUG(!l);
-	AA_BUG(write_can_lock(&ls->lock));
+	AA_BUG(smp_write_can_lock(&ls->lock));
 	AA_BUG(l->flags & FLAG_IN_TREE);
 
 	/* Figure out where to put new node */