aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlabel/netlabel_unlabeled.c
diff options
context:
space:
mode:
authorPaul Moore <paul.moore@hp.com>2008-01-29 08:37:52 -0500
committerJames Morris <jmorris@namei.org>2008-01-29 16:17:16 -0500
commitc783f1ce5712530ba404807c55d77ac782eb8a7d (patch)
tree3153ec98b5c6d57eb5a0aad43389d4faa6d63586 /net/netlabel/netlabel_unlabeled.c
parent0ba6c33bcddc64a54b5f1c25a696c4767dc76292 (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_unlabeled.c')
-rw-r--r--net/netlabel/netlabel_unlabeled.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 348292450deb..fd53c7ae2977 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -29,7 +29,6 @@
29 */ 29 */
30 30
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/rcupdate.h>
33#include <linux/list.h> 32#include <linux/list.h>
34#include <linux/spinlock.h> 33#include <linux/spinlock.h>
35#include <linux/socket.h> 34#include <linux/socket.h>
@@ -48,7 +47,6 @@
48#include "netlabel_unlabeled.h" 47#include "netlabel_unlabeled.h"
49 48
50/* Accept unlabeled packets flag */ 49/* Accept unlabeled packets flag */
51static DEFINE_SPINLOCK(netlabel_unlabel_acceptflg_lock);
52static u8 netlabel_unlabel_acceptflg = 0; 50static u8 netlabel_unlabel_acceptflg = 0;
53 51
54/* NetLabel Generic NETLINK CIPSOv4 family */ 52/* NetLabel Generic NETLINK CIPSOv4 family */
@@ -84,11 +82,8 @@ static void netlbl_unlabel_acceptflg_set(u8 value,
84 struct audit_buffer *audit_buf; 82 struct audit_buffer *audit_buf;
85 u8 old_val; 83 u8 old_val;
86 84
87 spin_lock(&netlabel_unlabel_acceptflg_lock);
88 old_val = netlabel_unlabel_acceptflg; 85 old_val = netlabel_unlabel_acceptflg;
89 netlabel_unlabel_acceptflg = value; 86 netlabel_unlabel_acceptflg = value;
90 spin_unlock(&netlabel_unlabel_acceptflg_lock);
91
92 audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_ALLOW, 87 audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_ALLOW,
93 audit_info); 88 audit_info);
94 if (audit_buf != NULL) { 89 if (audit_buf != NULL) {
@@ -155,11 +150,9 @@ static int netlbl_unlabel_list(struct sk_buff *skb, struct genl_info *info)
155 goto list_failure; 150 goto list_failure;
156 } 151 }
157 152
158 rcu_read_lock();
159 ret_val = nla_put_u8(ans_skb, 153 ret_val = nla_put_u8(ans_skb,
160 NLBL_UNLABEL_A_ACPTFLG, 154 NLBL_UNLABEL_A_ACPTFLG,
161 netlabel_unlabel_acceptflg); 155 netlabel_unlabel_acceptflg);
162 rcu_read_unlock();
163 if (ret_val != 0) 156 if (ret_val != 0)
164 goto list_failure; 157 goto list_failure;
165 158
@@ -245,17 +238,10 @@ int netlbl_unlabel_genl_init(void)
245 */ 238 */
246int netlbl_unlabel_getattr(struct netlbl_lsm_secattr *secattr) 239int netlbl_unlabel_getattr(struct netlbl_lsm_secattr *secattr)
247{ 240{
248 int ret_val; 241 if (netlabel_unlabel_acceptflg == 0)
249 242 return -ENOMSG;
250 rcu_read_lock(); 243 netlbl_secattr_init(secattr);
251 if (netlabel_unlabel_acceptflg == 1) { 244 return 0;
252 netlbl_secattr_init(secattr);
253 ret_val = 0;
254 } else
255 ret_val = -ENOMSG;
256 rcu_read_unlock();
257
258 return ret_val;
259} 245}
260 246
261/** 247/**