~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/rcu-document-lock_both_profiles.diff

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-04-27 10:38:07 UTC
  • mfrom: (5.1.118 natty)
  • Revision ID: james.westby@ubuntu.com-20110427103807-ym3rhwys6o84ith0
Tags: 2.6.1-2
debian/copyright: clarify for some full organization names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: linux-2.6-apparmor/security/apparmor/inline.h
2
 
===================================================================
3
 
--- linux-2.6-apparmor.orig/security/apparmor/inline.h
4
 
+++ linux-2.6-apparmor/security/apparmor/inline.h
5
 
@@ -143,6 +143,8 @@ static inline void unlock_profile(struct
6
 
 
7
 
 /**
8
 
  * lock_both_profiles  -  lock two profiles in a deadlock-free way
9
 
+ * @profile1:  profile to lock (may be NULL)
10
 
+ * @profile2:  profile to lock (may be NULL)
11
 
  *
12
 
  * The order in which profiles are passed into lock_both_profiles() /
13
 
  * unlock_both_profiles() does not matter.
14
 
@@ -172,11 +174,13 @@ static inline void lock_both_profiles(st
15
 
                if (profile2)
16
 
                        spin_lock_irqsave(&profile2->lock, profile2->int_flags);
17
 
        } else if (profile1 > profile2) {
18
 
+               /* profile1 cannot be NULL here. */
19
 
                spin_lock_irqsave(&profile1->lock, profile1->int_flags);
20
 
                if (profile2)
21
 
                        spin_lock(&profile2->lock);
22
 
 
23
 
        } else {
24
 
+               /* profile2 cannot be NULL here. */
25
 
                spin_lock_irqsave(&profile2->lock, profile2->int_flags);
26
 
                spin_lock(&profile1->lock);
27
 
        }
28
 
@@ -184,6 +188,8 @@ static inline void lock_both_profiles(st
29
 
 
30
 
 /**
31
 
  * unlock_both_profiles  -  unlock two profiles in a deadlock-free way
32
 
+ * @profile1:  profile to unlock (may be NULL)
33
 
+ * @profile2:  profile to unlock (may be NULL)
34
 
  *
35
 
  * The order in which profiles are passed into lock_both_profiles() /
36
 
  * unlock_both_profiles() does not matter.
37
 
@@ -205,10 +211,12 @@ static inline void unlock_both_profiles(
38
 
                        spin_unlock_irqrestore(&profile2->lock,
39
 
                                               profile2->int_flags);
40
 
        } else if (profile1 > profile2) {
41
 
+               /* profile1 cannot be NULL here. */
42
 
                if (profile2)
43
 
                        spin_unlock(&profile2->lock);
44
 
                spin_unlock_irqrestore(&profile1->lock, profile1->int_flags);
45
 
        } else {
46
 
+               /* profile2 cannot be NULL here. */
47
 
                spin_unlock(&profile1->lock);
48
 
                spin_unlock_irqrestore(&profile2->lock, profile2->int_flags);
49
 
        }