aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--security/selinux/hooks.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 2e8b4dfcbc74..a91c961ba38b 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -523,12 +523,16 @@ static int try_context_mount(struct super_block *sb, void *data)
523 goto out_free; 523 goto out_free;
524 } 524 }
525 525
526 rc = may_context_mount_sb_relabel(sid, sbsec, tsec); 526 if (!fscontext) {
527 if (rc) 527 rc = may_context_mount_sb_relabel(sid, sbsec, tsec);
528 goto out_free; 528 if (rc)
529 529 goto out_free;
530 if (!fscontext)
531 sbsec->sid = sid; 530 sbsec->sid = sid;
531 } else {
532 rc = may_context_mount_inode_relabel(sid, sbsec, tsec);
533 if (rc)
534 goto out_free;
535 }
532 sbsec->mntpoint_sid = sid; 536 sbsec->mntpoint_sid = sid;
533 537
534 sbsec->behavior = SECURITY_FS_USE_MNTPOINT; 538 sbsec->behavior = SECURITY_FS_USE_MNTPOINT;