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: <20091104114020.5a2aef2c@nehalam>
Date:	Wed, 4 Nov 2009 11:40:20 -0800
From:	Stephen Hemminger <shemminger@...tta.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	"David S. Miller" <davem@...emloft.net>,
	Linux Netdev List <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next-2.6] bridge: remove dev_put() in add_del_if()

On Wed, 04 Nov 2009 20:09:07 +0100
Eric Dumazet <eric.dumazet@...il.com> wrote:

> add_del_if() is called with RTNL, we can use __dev_get_by_index()
> instead of [dev_get_by_index() + dev_put()]
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
> ---
>  net/bridge/br_ioctl.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c
> index 6a6433d..2af6e4a 100644
> --- a/net/bridge/br_ioctl.c
> +++ b/net/bridge/br_ioctl.c
> @@ -81,6 +81,7 @@ static int get_fdb_entries(struct net_bridge *br, void __user *userbuf,
>  	return num;
>  }
>  
> +/* called with RTNL */
>  static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
>  {
>  	struct net_device *dev;
> @@ -89,7 +90,7 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
>  	if (!capable(CAP_NET_ADMIN))
>  		return -EPERM;
>  
> -	dev = dev_get_by_index(dev_net(br->dev), ifindex);
> +	dev = __dev_get_by_index(dev_net(br->dev), ifindex);
>  	if (dev == NULL)
>  		return -EINVAL;
>  
> @@ -98,7 +99,6 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
>  	else
>  		ret = br_del_if(br, dev);
>  
> -	dev_put(dev);
>  	return ret;
>  }
>  

As part of the general ref count purge sure.
Acked-by: Stephen Hemminger <shemminger@...tta.com>

-- 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ