diff options
author | Paul Moore <paul.moore@hp.com> | 2008-01-29 08:37:52 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-01-29 16:17:16 -0500 |
commit | c783f1ce5712530ba404807c55d77ac782eb8a7d (patch) | |
tree | 3153ec98b5c6d57eb5a0aad43389d4faa6d63586 /net/netlabel/netlabel_mgmt.c | |
parent | 0ba6c33bcddc64a54b5f1c25a696c4767dc76292 (diff) |
NetLabel: Remove unneeded RCU read locks
This patch removes some unneeded RCU read locks as we can treat the reads as
"safe" even without RCU. It also converts the NetLabel configuration refcount
from a spinlock protected u32 into atomic_t to be more consistent with the rest
of the kernel.
Signed-off-by: Paul Moore <paul.moore@hp.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'net/netlabel/netlabel_mgmt.c')
-rw-r--r-- | net/netlabel/netlabel_mgmt.c | 63 |
1 files changed, 3 insertions, 60 deletions
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c index 9c41464d58d1..e2258dc3c845 100644 --- a/net/netlabel/netlabel_mgmt.c +++ b/net/netlabel/netlabel_mgmt.c | |||
@@ -37,14 +37,14 @@ | |||
37 | #include <net/genetlink.h> | 37 | #include <net/genetlink.h> |
38 | #include <net/netlabel.h> | 38 | #include <net/netlabel.h> |
39 | #include <net/cipso_ipv4.h> | 39 | #include <net/cipso_ipv4.h> |
40 | #include <asm/atomic.h> | ||
40 | 41 | ||
41 | #include "netlabel_domainhash.h" | 42 | #include "netlabel_domainhash.h" |
42 | #include "netlabel_user.h" | 43 | #include "netlabel_user.h" |
43 | #include "netlabel_mgmt.h" | 44 | #include "netlabel_mgmt.h" |
44 | 45 | ||
45 | /* NetLabel configured protocol count */ | 46 | /* NetLabel configured protocol counter */ |
46 | static DEFINE_SPINLOCK(netlabel_mgmt_protocount_lock); | 47 | atomic_t netlabel_mgmt_protocount = ATOMIC_INIT(0); |
47 | static u32 netlabel_mgmt_protocount = 0; | ||
48 | 48 | ||
49 | /* Argument struct for netlbl_domhsh_walk() */ | 49 | /* Argument struct for netlbl_domhsh_walk() */ |
50 | struct netlbl_domhsh_walk_arg { | 50 | struct netlbl_domhsh_walk_arg { |
@@ -71,63 +71,6 @@ static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = { | |||
71 | }; | 71 | }; |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * NetLabel Misc Management Functions | ||
75 | */ | ||
76 | |||
77 | /** | ||
78 | * netlbl_mgmt_protocount_inc - Increment the configured labeled protocol count | ||
79 | * | ||
80 | * Description: | ||
81 | * Increment the number of labeled protocol configurations in the current | ||
82 | * NetLabel configuration. Keep track of this for use in determining if | ||
83 | * NetLabel label enforcement should be active/enabled or not in the LSM. | ||
84 | * | ||
85 | */ | ||
86 | void netlbl_mgmt_protocount_inc(void) | ||
87 | { | ||
88 | spin_lock(&netlabel_mgmt_protocount_lock); | ||
89 | netlabel_mgmt_protocount++; | ||
90 | spin_unlock(&netlabel_mgmt_protocount_lock); | ||
91 | } | ||
92 | |||
93 | /** | ||
94 | * netlbl_mgmt_protocount_dec - Decrement the configured labeled protocol count | ||
95 | * | ||
96 | * Description: | ||
97 | * Decrement the number of labeled protocol configurations in the current | ||
98 | * NetLabel configuration. Keep track of this for use in determining if | ||
99 | * NetLabel label enforcement should be active/enabled or not in the LSM. | ||
100 | * | ||
101 | */ | ||
102 | void netlbl_mgmt_protocount_dec(void) | ||
103 | { | ||
104 | spin_lock(&netlabel_mgmt_protocount_lock); | ||
105 | if (netlabel_mgmt_protocount > 0) | ||
106 | netlabel_mgmt_protocount--; | ||
107 | spin_unlock(&netlabel_mgmt_protocount_lock); | ||
108 | } | ||
109 | |||
110 | /** | ||
111 | * netlbl_mgmt_protocount_value - Return the number of configured protocols | ||
112 | * | ||
113 | * Description: | ||
114 | * Return the number of labeled protocols in the current NetLabel | ||
115 | * configuration. This value is useful in determining if NetLabel label | ||
116 | * enforcement should be active/enabled or not in the LSM. | ||
117 | * | ||
118 | */ | ||
119 | u32 netlbl_mgmt_protocount_value(void) | ||
120 | { | ||
121 | u32 val; | ||
122 | |||
123 | rcu_read_lock(); | ||
124 | val = netlabel_mgmt_protocount; | ||
125 | rcu_read_unlock(); | ||
126 | |||
127 | return val; | ||
128 | } | ||
129 | |||
130 | /* | ||
131 | * NetLabel Command Handlers | 74 | * NetLabel Command Handlers |
132 | */ | 75 | */ |
133 | 76 | ||