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: <92eab1fc-cd70-1561-1f94-665e77725750@cumulusnetworks.com>
Date:   Mon, 1 May 2017 09:08:17 -0600
From:   David Ahern <dsa@...ulusnetworks.com>
To:     gfree.wind@...mail.com, davem@...emloft.net, jarod@...hat.com,
        lucien.xin@...il.com, stephen@...workplumber.org,
        netdev@...r.kernel.org
Subject: Re: [PATCH net v3] driver: veth: Fix one possbile memleak when fail
 to register_netdevice

On 4/28/17 9:51 PM, gfree.wind@...mail.com wrote:
> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index 8c39d6d..418376a 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -224,9 +224,21 @@ static int veth_dev_init(struct net_device *dev)
>  	return 0;
>  }
>  
> -static void veth_dev_free(struct net_device *dev)
> +static void veth_destructor_free(struct net_device *dev)

_destructor in the name is confusing since veth_dev_free is the
dev->destructor. Perhaps that should be veth_free_stats.


>  {
>  	free_percpu(dev->vstats);
> +}
> +
> +static void veth_dev_uninit(struct net_device *dev)
> +{
> +	/* dev is not registered, perform the free instead of destructor */
> +	if (dev->reg_state == NETREG_UNINITIALIZED)
> +		veth_destructor_free(dev);
> +}
> +
> +static void veth_dev_free(struct net_device *dev)
> +{
> +	veth_destructor_free(dev);
>  	free_netdev(dev);
>  }
>  
> @@ -284,6 +296,7 @@ static void veth_set_rx_headroom(struct net_device *dev, int new_hr)
>  
>  static const struct net_device_ops veth_netdev_ops = {
>  	.ndo_init            = veth_dev_init,
> +	.ndo_uninit          = veth_dev_uninit,
>  	.ndo_open            = veth_open,
>  	.ndo_stop            = veth_close,
>  	.ndo_start_xmit      = veth_xmit,
> 

Functionally, it looks good to me.

Acked-by: David Ahern <dsa@...ulusnetworks.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ