lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a78df05f-bd74-a14d-9738-5fc61cd658e0@schaufler-ca.com>
Date:   Tue, 23 Aug 2016 14:56:20 -0700
From:   Casey Schaufler <casey@...aufler-ca.com>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>,
        linux-security-module@...r.kernel.org,
        James Morris <james.l.morris@...cle.com>,
        "Serge E. Hallyn" <serge@...lyn.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Julia Lawall <julia.lawall@...6.fr>,
        Nicolas Palix <nicolas.palix@...g.fr>
Subject: Re: [PATCH] Smack: Use memdup_user() rather than duplicating its
 implementation

On 8/21/2016 11:26 AM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Sun, 21 Aug 2016 20:17:36 +0200
>
> Reuse existing functionality from memdup_user() instead of keeping
> duplicate source code.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>

Acked-by: Casey Schaufler <casey@...aufler-ca.com>

Applied to git://github.com/cschaufler/smack-next.git#smack-for-4.9

> ---
>  security/smack/smackfs.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
> index e249a66..6492fe9 100644
> --- a/security/smack/smackfs.c
> +++ b/security/smack/smackfs.c
> @@ -2523,14 +2523,9 @@ static ssize_t smk_write_revoke_subj(struct file *file, const char __user *buf,
>  	if (count == 0 || count > SMK_LONGLABEL)
>  		return -EINVAL;
>  
> -	data = kzalloc(count, GFP_KERNEL);
> -	if (data == NULL)
> -		return -ENOMEM;
> -
> -	if (copy_from_user(data, buf, count) != 0) {
> -		rc = -EFAULT;
> -		goto out_data;
> -	}
> +	data = memdup_user(buf, count);
> +	if (IS_ERR(data))
> +		return PTR_ERR(data);
>  
>  	cp = smk_parse_smack(data, count);
>  	if (IS_ERR(cp)) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ