mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Morris <jmorris@namei.org>
To: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Stephen Smalley <sds@epoch.ncsc.mil>,
	James Morris <jmorris@redhat.com>
Subject: Re: [PATCH] selinux: check for failed kmalloc in security_sid_to_context
Date: Wed, 26 Apr 2006 23:25:46 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0604262325090.5735@d.namei> (raw)
In-Reply-To: <20060427020740.GA23112@sergelap.austin.ibm.com>

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;
> 

-- 
James Morris
<jmorris@namei.org>


  reply	other threads:[~2006-04-27  3:25 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 [this message]
2006-05-08 17:46   ` Andrew Morton
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=Pine.LNX.4.64.0604262325090.5735@d.namei \
    --to=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®