mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: sds@tycho.nsa.gov, james.l.morris@oracle.com, eparis@parisplace.org
Cc: linux-security-module@vger.kernel.org, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] selinux: make return code consistent with conflicting context= settings on same superblock
Date: Wed,  8 May 2013 14:40:20 -0400	[thread overview]
Message-ID: <1368038420-19879-1-git-send-email-jlayton@redhat.com> (raw)

Commit 094f7b69ea73 adds a new check to ensure that when we clone an
existing superblock that the contexts match properly. We do however have
another place where you can hit similar problems in
selinux_set_mnt_opts. That function returns -EINVAL, whereas
selinux_sb_clone_mnt_opts returns -EBUSY in this situation.

I think -EBUSY is probably more descriptive of the situation here. The
context= option would have worked had the superblock not already been in
use. Fix selinux_set_mnt_opts to return -EBUSY instead of -EINVAL in
this situation.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 security/selinux/hooks.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 5c6f2cd..348f069 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -745,7 +745,7 @@ out:
 	mutex_unlock(&sbsec->lock);
 	return rc;
 out_double_mount:
-	rc = -EINVAL;
+	rc = -EBUSY;
 	printk(KERN_WARNING "SELinux: mount invalid.  Same superblock, different "
 	       "security settings for (dev %s, type %s)\n", sb->s_id, name);
 	goto out;
-- 
1.7.1


                 reply	other threads:[~2013-05-08 18:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368038420-19879-1-git-send-email-jlayton@redhat.com \
    --to=jlayton@redhat.com \
    --cc=eparis@parisplace.org \
    --cc=james.l.morris@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=sds@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®