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: <20160822044347-mutt-send-email-mst@kernel.org>
Date:   Mon, 22 Aug 2016 04:43:53 +0300
From:   "Michael S. Tsirkin" <mst@...hat.com>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc:     netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jason Wang <jasowang@...hat.com>,
        Mike Rapoport <rppt@...ux.vnet.ibm.com>,
        Paolo Abeni <pabeni@...hat.com>,
        Soheil Hassas Yeganeh <soheil@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 1/2] tun: Use memdup_user() rather than duplicating its
 implementation

On Sat, Aug 20, 2016 at 09:34:56AM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Sat, 20 Aug 2016 08:54:15 +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: Michael S. Tsirkin <mst@...hat.com>

> ---
>  drivers/net/tun.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 9c8b5bc..a1aeccb 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -731,14 +731,9 @@ static int update_filter(struct tap_filter *filter, void __user *arg)
>  	}
>  
>  	alen = ETH_ALEN * uf.count;
> -	addr = kmalloc(alen, GFP_KERNEL);
> -	if (!addr)
> -		return -ENOMEM;
> -
> -	if (copy_from_user(addr, arg + sizeof(uf), alen)) {
> -		err = -EFAULT;
> -		goto done;
> -	}
> +	addr = memdup_user(arg + sizeof(uf), alen);
> +	if (IS_ERR(addr))
> +		return PTR_ERR(addr);
>  
>  	/* The filter is updated without holding any locks. Which is
>  	 * perfectly safe. We disable it first and in the worst
> -- 
> 2.9.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ