Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jiri Pirko <jpirko@redhat.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	bhutchings@solarflare.com, shemminger@vyatta.com,
	andy@greyhouse.net, fbl@redhat.com, jzupka@redhat.com,
	ivecera@redhat.com
Subject: Re: [patch net-next 1/3] team: Do not hold rcu_read_lock when running netlink cmds
Date: Wed, 16 Nov 2011 22:17:24 +0100	[thread overview]
Message-ID: <1321478244.3274.5.camel@edumazet-laptop> (raw)
In-Reply-To: <1321477749-1877-2-git-send-email-jpirko@redhat.com>

Le mercredi 16 novembre 2011 à 22:09 +0100, Jiri Pirko a écrit :
> Signed-off-by: Jiri Pirko <jpirko@redhat.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,

  reply	other threads:[~2011-11-16 21:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-16 21:09 [patch net-next 0/3] team: bug fixes Jiri Pirko
2011-11-16 21:09 ` [patch net-next 1/3] team: Do not hold rcu_read_lock when running netlink cmds Jiri Pirko
2011-11-16 21:17   ` Eric Dumazet [this message]
2011-11-16 21:55     ` [patch net-next 1/3 v2] " Jiri Pirko
2011-11-17  1:36       ` David Miller
2011-11-16 21:09 ` [patch net-next 2/3] team: convert overall spinlock to mutex Jiri Pirko
2011-11-17  1:36   ` David Miller
2011-11-16 21:09 ` [patch net-next 3/3] team: replicate options on register Jiri Pirko
2011-11-17  1:36   ` David Miller
2011-11-17  8:32   ` Eric Dumazet
2011-11-17  9:57     ` Jiri Pirko
2011-11-17 10:00       ` Eric Dumazet
2011-11-17 10:03         ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321478244.3274.5.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=andy@greyhouse.net \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=fbl@redhat.com \
    --cc=ivecera@redhat.com \
    --cc=jpirko@redhat.com \
    --cc=jzupka@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox