aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/mls.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/selinux/ss/mls.c')
-rw-r--r--security/selinux/ss/mls.c30
1 files changed, 5 insertions, 25 deletions
diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
index b4f682dc13ff..4a8bab2f3c71 100644
--- a/security/selinux/ss/mls.c
+++ b/security/selinux/ss/mls.c
@@ -270,7 +270,7 @@ int mls_context_to_sid(char oldc,
270 if (!defcon) 270 if (!defcon)
271 goto out; 271 goto out;
272 272
273 rc = mls_copy_context(context, defcon); 273 rc = mls_context_cpy(context, defcon);
274 goto out; 274 goto out;
275 } 275 }
276 276
@@ -401,26 +401,6 @@ int mls_from_string(char *str, struct context *context, gfp_t gfp_mask)
401} 401}
402 402
403/* 403/*
404 * Copies the effective MLS range from `src' into `dst'.
405 */
406static inline int mls_scopy_context(struct context *dst,
407 struct context *src)
408{
409 int l, rc = 0;
410
411 /* Copy the MLS range from the source context */
412 for (l = 0; l < 2; l++) {
413 dst->range.level[l].sens = src->range.level[0].sens;
414 rc = ebitmap_cpy(&dst->range.level[l].cat,
415 &src->range.level[0].cat);
416 if (rc)
417 break;
418 }
419
420 return rc;
421}
422
423/*
424 * Copies the MLS range `range' into `context'. 404 * Copies the MLS range `range' into `context'.
425 */ 405 */
426static inline int mls_range_set(struct context *context, 406static inline int mls_range_set(struct context *context,
@@ -552,19 +532,19 @@ int mls_compute_sid(struct context *scontext,
552 case AVTAB_CHANGE: 532 case AVTAB_CHANGE:
553 if (tclass == SECCLASS_PROCESS) 533 if (tclass == SECCLASS_PROCESS)
554 /* Use the process MLS attributes. */ 534 /* Use the process MLS attributes. */
555 return mls_copy_context(newcontext, scontext); 535 return mls_context_cpy(newcontext, scontext);
556 else 536 else
557 /* Use the process effective MLS attributes. */ 537 /* Use the process effective MLS attributes. */
558 return mls_scopy_context(newcontext, scontext); 538 return mls_context_cpy_low(newcontext, scontext);
559 case AVTAB_MEMBER: 539 case AVTAB_MEMBER:
560 /* Only polyinstantiate the MLS attributes if 540 /* Only polyinstantiate the MLS attributes if
561 the type is being polyinstantiated */ 541 the type is being polyinstantiated */
562 if (newcontext->type != tcontext->type) { 542 if (newcontext->type != tcontext->type) {
563 /* Use the process effective MLS attributes. */ 543 /* Use the process effective MLS attributes. */
564 return mls_scopy_context(newcontext, scontext); 544 return mls_context_cpy_low(newcontext, scontext);
565 } else { 545 } else {
566 /* Use the related object MLS attributes. */ 546 /* Use the related object MLS attributes. */
567 return mls_copy_context(newcontext, tcontext); 547 return mls_context_cpy(newcontext, tcontext);
568 } 548 }
569 default: 549 default:
570 return -EINVAL; 550 return -EINVAL;