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: <xa1to9uvvfjq.fsf@mina86.com>
Date:   Sun, 14 May 2017 13:33:29 +0200
From:   Michal Nazarewicz <mina86@...a86.com>
To:     Geliang Tang <geliangtang@...il.com>,
        Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Vincent Pelletier <plr.vincent@...il.com>,
        Felix Hädicke <felixhaedicke@....de>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        Jim Lin <jilin@...dia.com>
Cc:     Geliang Tang <geliangtang@...il.com>, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: gadget: f_fs: use memdup_user

On Sat, May 13 2017, Geliang Tang wrote:
> Use memdup_user() helper instead of open-coding to simplify the code.
>
> Signed-off-by: Geliang Tang <geliangtang@...il.com>

Acked-by: Michal Nazarewicz <mina86@...a86.com>

> ---
>  drivers/usb/gadget/function/f_fs.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
> index 71dd27c..5754538 100644
> --- a/drivers/usb/gadget/function/f_fs.c
> +++ b/drivers/usb/gadget/function/f_fs.c
> @@ -3692,14 +3692,9 @@ static char *ffs_prepare_buffer(const char __user *buf, size_t len)
>  	if (unlikely(!len))
>  		return NULL;
>  
> -	data = kmalloc(len, GFP_KERNEL);
> -	if (unlikely(!data))
> -		return ERR_PTR(-ENOMEM);
> -
> -	if (unlikely(copy_from_user(data, buf, len))) {
> -		kfree(data);
> -		return ERR_PTR(-EFAULT);
> -	}
> +	data = memdup_user(buf, len);
> +	if (unlikely(IS_ERR(data)))
> +		return data;
>  
>  	pr_vdebug("Buffer from user space:\n");
>  	ffs_dump_mem("", data, len);

-- 
Best regards
ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ
«If at first you don’t succeed, give up skydiving»

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ