aboutsummaryrefslogtreecommitdiffstats
path: root/security/smack/smackfs.c
diff options
context:
space:
mode:
authorLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-12-29 00:47:18 -0500
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-12-29 00:47:18 -0500
commit0a8c5395f90f06d128247844b2515c8bf3f2826b (patch)
treed95382dcdfa303b99d480c01763d6cb6767fdaca /security/smack/smackfs.c
parent25051158bbed127e8672b43396c71c5eb610e5f1 (diff)
parent3c92ec8ae91ecf59d88c798301833d7cf83f2179 (diff)
[XFS] Fix merge failures
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 Conflicts: fs/xfs/linux-2.6/xfs_cred.h fs/xfs/linux-2.6/xfs_globals.h fs/xfs/linux-2.6/xfs_ioctl.c fs/xfs/xfs_vnodeops.h Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'security/smack/smackfs.c')
-rw-r--r--security/smack/smackfs.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index c21d8c8bf0c7..247dc9ebbc71 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -185,11 +185,15 @@ static int smk_open_load(struct inode *inode, struct file *file)
185 * the subject/object pair and replaces the access that was 185 * the subject/object pair and replaces the access that was
186 * there. If the pair isn't found add it with the specified 186 * there. If the pair isn't found add it with the specified
187 * access. 187 * access.
188 *
189 * Returns 0 if nothing goes wrong or -ENOMEM if it fails
190 * during the allocation of the new pair to add.
188 */ 191 */
189static void smk_set_access(struct smack_rule *srp) 192static int smk_set_access(struct smack_rule *srp)
190{ 193{
191 struct smk_list_entry *sp; 194 struct smk_list_entry *sp;
192 struct smk_list_entry *newp; 195 struct smk_list_entry *newp;
196 int ret = 0;
193 197
194 mutex_lock(&smack_list_lock); 198 mutex_lock(&smack_list_lock);
195 199
@@ -202,14 +206,20 @@ static void smk_set_access(struct smack_rule *srp)
202 206
203 if (sp == NULL) { 207 if (sp == NULL) {
204 newp = kzalloc(sizeof(struct smk_list_entry), GFP_KERNEL); 208 newp = kzalloc(sizeof(struct smk_list_entry), GFP_KERNEL);
209 if (newp == NULL) {
210 ret = -ENOMEM;
211 goto out;
212 }
213
205 newp->smk_rule = *srp; 214 newp->smk_rule = *srp;
206 newp->smk_next = smack_list; 215 newp->smk_next = smack_list;
207 smack_list = newp; 216 smack_list = newp;
208 } 217 }
209 218
219out:
210 mutex_unlock(&smack_list_lock); 220 mutex_unlock(&smack_list_lock);
211 221
212 return; 222 return ret;
213} 223}
214 224
215/** 225/**
@@ -309,8 +319,10 @@ static ssize_t smk_write_load(struct file *file, const char __user *buf,
309 goto out; 319 goto out;
310 } 320 }
311 321
312 smk_set_access(&rule); 322 rc = smk_set_access(&rule);
313 rc = count; 323
324 if (!rc)
325 rc = count;
314 326
315out: 327out:
316 kfree(data); 328 kfree(data);
@@ -336,7 +348,7 @@ static void smk_cipso_doi(void)
336 348
337 audit_info.loginuid = audit_get_loginuid(current); 349 audit_info.loginuid = audit_get_loginuid(current);
338 audit_info.sessionid = audit_get_sessionid(current); 350 audit_info.sessionid = audit_get_sessionid(current);
339 audit_info.secid = smack_to_secid(current->security); 351 audit_info.secid = smack_to_secid(current_security());
340 352
341 rc = netlbl_cfg_map_del(NULL, &audit_info); 353 rc = netlbl_cfg_map_del(NULL, &audit_info);
342 if (rc != 0) 354 if (rc != 0)
@@ -371,7 +383,7 @@ static void smk_unlbl_ambient(char *oldambient)
371 383
372 audit_info.loginuid = audit_get_loginuid(current); 384 audit_info.loginuid = audit_get_loginuid(current);
373 audit_info.sessionid = audit_get_sessionid(current); 385 audit_info.sessionid = audit_get_sessionid(current);
374 audit_info.secid = smack_to_secid(current->security); 386 audit_info.secid = smack_to_secid(current_security());
375 387
376 if (oldambient != NULL) { 388 if (oldambient != NULL) {
377 rc = netlbl_cfg_map_del(oldambient, &audit_info); 389 rc = netlbl_cfg_map_del(oldambient, &audit_info);
@@ -843,7 +855,7 @@ static ssize_t smk_write_onlycap(struct file *file, const char __user *buf,
843 size_t count, loff_t *ppos) 855 size_t count, loff_t *ppos)
844{ 856{
845 char in[SMK_LABELLEN]; 857 char in[SMK_LABELLEN];
846 char *sp = current->security; 858 char *sp = current->cred->security;
847 859
848 if (!capable(CAP_MAC_ADMIN)) 860 if (!capable(CAP_MAC_ADMIN))
849 return -EPERM; 861 return -EPERM;