aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--security/selinux/ss/conditional.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
index 775418aa0a8e..aac40c7ff28c 100644
--- a/security/selinux/ss/conditional.c
+++ b/security/selinux/ss/conditional.c
@@ -263,7 +263,7 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum
263 struct cond_av_list *other = data->other, *list, *cur; 263 struct cond_av_list *other = data->other, *list, *cur;
264 struct avtab_node *node_ptr; 264 struct avtab_node *node_ptr;
265 u8 found; 265 u8 found;
266 266 int rc = -EINVAL;
267 267
268 /* 268 /*
269 * For type rules we have to make certain there aren't any 269 * For type rules we have to make certain there aren't any
@@ -313,12 +313,15 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum
313 node_ptr = avtab_insert_nonunique(&p->te_cond_avtab, k, d); 313 node_ptr = avtab_insert_nonunique(&p->te_cond_avtab, k, d);
314 if (!node_ptr) { 314 if (!node_ptr) {
315 printk(KERN_ERR "SELinux: could not insert rule.\n"); 315 printk(KERN_ERR "SELinux: could not insert rule.\n");
316 rc = -ENOMEM;
316 goto err; 317 goto err;
317 } 318 }
318 319
319 list = kzalloc(sizeof(struct cond_av_list), GFP_KERNEL); 320 list = kzalloc(sizeof(struct cond_av_list), GFP_KERNEL);
320 if (!list) 321 if (!list) {
322 rc = -ENOMEM;
321 goto err; 323 goto err;
324 }
322 325
323 list->node = node_ptr; 326 list->node = node_ptr;
324 if (!data->head) 327 if (!data->head)
@@ -331,7 +334,7 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum
331err: 334err:
332 cond_av_list_destroy(data->head); 335 cond_av_list_destroy(data->head);
333 data->head = NULL; 336 data->head = NULL;
334 return -1; 337 return rc;
335} 338}
336 339
337static int cond_read_av_list(struct policydb *p, void *fp, struct cond_av_list **ret_list, struct cond_av_list *other) 340static int cond_read_av_list(struct policydb *p, void *fp, struct cond_av_list **ret_list, struct cond_av_list *other)
@@ -345,8 +348,8 @@ static int cond_read_av_list(struct policydb *p, void *fp, struct cond_av_list *
345 348
346 len = 0; 349 len = 0;
347 rc = next_entry(buf, fp, sizeof(u32)); 350 rc = next_entry(buf, fp, sizeof(u32));
348 if (rc < 0) 351 if (rc)
349 return -1; 352 return rc;
350 353
351 len = le32_to_cpu(buf[0]); 354 len = le32_to_cpu(buf[0]);
352 if (len == 0) 355 if (len == 0)
@@ -361,7 +364,6 @@ static int cond_read_av_list(struct policydb *p, void *fp, struct cond_av_list *
361 &data); 364 &data);
362 if (rc) 365 if (rc)
363 return rc; 366 return rc;
364
365 } 367 }
366 368
367 *ret_list = data.head; 369 *ret_list = data.head;