mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: James Morris <jmorris@namei.org>
Cc: serue@us.ibm.com, linux-kernel@vger.kernel.org,
	sds@epoch.ncsc.mil, jmorris@redhat.com
Subject: Re: [PATCH] selinux: check for failed kmalloc in security_sid_to_context
Date: Mon, 8 May 2006 10:46:59 -0700	[thread overview]
Message-ID: <20060508104659.7f17f38d.akpm@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0604262325090.5735@d.namei>

James Morris <jmorris@namei.org> wrote:
>
> On Wed, 26 Apr 2006, Serge E. Hallyn wrote:
> 
> > Check for NULL kmalloc return value before writing to it.
> > 
> > Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
> 
> Acked-by: James Morris <jmorris@namei.org>
> 
> 
> > ---
> > 
> >  security/selinux/ss/services.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > 3d9cf05c7fa2578f87648dd0862e70cf7959ad7a
> > diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
> > index 6149248..20b1065 100644
> > --- a/security/selinux/ss/services.c
> > +++ b/security/selinux/ss/services.c
> > @@ -593,6 +593,10 @@ int security_sid_to_context(u32 sid, cha
> >  
> >  			*scontext_len = strlen(initial_sid_to_string[sid]) + 1;
> >  			scontextp = kmalloc(*scontext_len,GFP_ATOMIC);
> > +			if (!scontextp) {
> > +				rc = -ENOMEM;
> > +				goto out;
> > +			}
> >  			strcpy(scontextp, initial_sid_to_string[sid]);
> >  			*scontext = scontextp;
> >  			goto out;
> > 
> 

Given that GFP_ATOMIC can fail and it'll cause an oops I'll queue this for
2.6.17 and shall send it in the direction of the -stable guys too, thanks.

What will happen when one of the GFP_ATOMIC allocations in there fails? 
Will the computer become insecure?


  reply	other threads:[~2006-05-08 17:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-27  2:07 Serge E. Hallyn
2006-04-27  3:25 ` James Morris
2006-05-08 17:46   ` Andrew Morton [this message]
2006-05-08 18:21     ` Stephen Smalley

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=20060508104659.7f17f38d.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=jmorris@namei.org \
    --cc=jmorris@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sds@epoch.ncsc.mil \
    --cc=serue@us.ibm.com \
    /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®