From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935364AbbI2SLv (ORCPT ); Tue, 29 Sep 2015 14:11:51 -0400 Received: from emvm-gh1-uea09.nsa.gov ([63.239.67.10]:62712 "EHLO emvm-gh1-uea09.nsa.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935106AbbI2SLm (ORCPT ); Tue, 29 Sep 2015 14:11:42 -0400 X-TM-IMSS-Message-ID: <331cd5d1000045ca@nsa.gov> Subject: Re: [PATCH 3/5] selinux: use kmemdup in security_sid_to_context_core() To: Rasmus Villemoes , Paul Moore , Eric Paris , James Morris , "Serge E. Hallyn" References: <1443220459-11042-1-git-send-email-linux@rasmusvillemoes.dk> <1443220459-11042-4-git-send-email-linux@rasmusvillemoes.dk> Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, selinux@tycho.nsa.gov From: Stephen Smalley Organization: National Security Agency Message-ID: <560AD436.1070005@tycho.nsa.gov> Date: Tue, 29 Sep 2015 14:11:02 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1443220459-11042-4-git-send-email-linux@rasmusvillemoes.dk> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/25/2015 06:34 PM, Rasmus Villemoes wrote: > Signed-off-by: Rasmus Villemoes Acked-by: Stephen Smalley > --- > security/selinux/ss/services.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c > index c550df0e0ff1..994c824a34c6 100644 > --- a/security/selinux/ss/services.c > +++ b/security/selinux/ss/services.c > @@ -1259,12 +1259,12 @@ static int security_sid_to_context_core(u32 sid, char **scontext, > *scontext_len = strlen(initial_sid_to_string[sid]) + 1; > if (!scontext) > goto out; > - scontextp = kmalloc(*scontext_len, GFP_ATOMIC); > + scontextp = kmemdup(initial_sid_to_string[sid], > + *scontext_len, GFP_ATOMIC); > if (!scontextp) { > rc = -ENOMEM; > goto out; > } > - strcpy(scontextp, initial_sid_to_string[sid]); > *scontext = scontextp; > goto out; > } >