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: <1321478244.3274.5.camel@edumazet-laptop>
Date:	Wed, 16 Nov 2011 22:17:24 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Jiri Pirko <jpirko@...hat.com>
Cc:	netdev@...r.kernel.org, davem@...emloft.net,
	bhutchings@...arflare.com, shemminger@...tta.com,
	andy@...yhouse.net, fbl@...hat.com, jzupka@...hat.com,
	ivecera@...hat.com
Subject: Re: [patch net-next 1/3] team: Do not hold rcu_read_lock when
 running netlink cmds

Le mercredi 16 novembre 2011 à 22:09 +0100, Jiri Pirko a écrit :
> Signed-off-by: Jiri Pirko <jpirko@...hat.com>
> ---
>  drivers/net/team/team.c |   12 ++++--------
>  1 files changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
> index 60672bb..e0cf11c 100644
> --- a/drivers/net/team/team.c
> +++ b/drivers/net/team/team.c
> @@ -1043,8 +1043,7 @@ err_msg_put:
>  
>  /*
>   * Netlink cmd functions should be locked by following two functions.
> - * To ensure team_uninit would not be called in between, hold rcu_read_lock
> - * all the time.
> + * Since dev gets held here, that ensures dev won't disappear in between.
>   */
>  static struct team *team_nl_team_get(struct genl_info *info)
>  {
> @@ -1057,12 +1056,9 @@ static struct team *team_nl_team_get(struct genl_info *info)
>  		return NULL;
>  
>  	ifindex = nla_get_u32(info->attrs[TEAM_ATTR_TEAM_IFINDEX]);
> -	rcu_read_lock();
> -	dev = dev_get_by_index_rcu(net, ifindex);
> -	if (!dev || dev->netdev_ops != &team_netdev_ops) {
> -		rcu_read_unlock();
> +	dev = dev_get_by_index(net, ifindex);
> +	if (!dev || dev->netdev_ops != &team_netdev_ops)

Hmmm, you return NULL but dev refcnt was increased...

>  		return NULL;
> -	}
>  
>  	team = netdev_priv(dev);
>  	spin_lock(&team->lock);
> @@ -1072,7 +1068,7 @@ static struct team *team_nl_team_get(struct genl_info *info)
>  static void team_nl_team_put(struct team *team)
>  {
>  	spin_unlock(&team->lock);
> -	rcu_read_unlock();
> +	dev_put(team->dev);
>  }
>  
>  static int team_nl_send_generic(struct genl_info *info, struct team *team,


--
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