All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: Linux Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: [PATCH linux-cr urgent] lsm: fix unlabeled restore case.
Date: Fri, 12 Mar 2010 14:47:06 -0600	[thread overview]
Message-ID: <20100312204706.GA408@us.ibm.com> (raw)

If an object is being restored which was checkpointed without an
LSM label, then we should return 0 BEFORE we try to ckpt_obj_fetch
a -1 objref (and obviously return error).

This makes the msg cr_tests ipc testcase fail if, for instance,
CONFIG_SECURITY=y but no LSM is active.

IMO this definately should be in the tree that gets sent out...

Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 security/security.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/security/security.c b/security/security.c
index 2b147cf..4b3f932 100644
--- a/security/security.c
+++ b/security/security.c
@@ -1528,14 +1528,14 @@ int security_restore_obj(struct ckpt_ctx *ctx, void *v, int sectype,
 		if (sectype != CKPT_SECURITY_MSG_MSG)
 			return 0;
 
-	l = ckpt_obj_fetch(ctx, secref, CKPT_OBJ_SECURITY);
-	if (IS_ERR(l))
-		return PTR_ERR(l);
-
 	/* return if checkpointed label was "Not Applicable" */
 	if (secref == SECURITY_CTX_NONE)
 		return 0;
 
+	l = ckpt_obj_fetch(ctx, secref, CKPT_OBJ_SECURITY);
+	if (IS_ERR(l))
+		return PTR_ERR(l);
+
 	/* Ask the LSM to apply a void*security to the object
 	 * based on the checkpointed context string */
 	switch (sectype) {
-- 
1.6.1

             reply	other threads:[~2010-03-12 20:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-12 20:47 Serge E. Hallyn [this message]
     [not found] ` <20100312204706.GA408-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-15  2:50   ` [PATCH linux-cr urgent] lsm: fix unlabeled restore case Oren Laadan

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=20100312204706.GA408@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.