Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Krishna Kumar <krkumar2@in.ibm.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [RFC] [PATCH] ipv6: Fix potential hang in mif6_add
Date: Wed, 02 May 2012 09:02:40 +0200	[thread overview]
Message-ID: <1335942160.22133.51.camel@edumazet-glaptop> (raw)
In-Reply-To: <20120502060957.30368.34595.sendpatchset@localhost.localdomain>

On Wed, 2012-05-02 at 11:39 +0530, Krishna Kumar wrote:
> Fix a potential "waiting for %s to become free" hang.
> mif6_add() called ip6mr_reg_vif to allocate/register a
> netdevice, which also took an extra reference on the
> device. On error, mif6_add should drop this reference
> before unregistering the device.
> 
> (untested, noticed from code walkthrough)
> 
> Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
> ---
>  net/ipv6/ip6mr.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -ruNp org/net/ipv6/ip6mr.c new/net/ipv6/ip6mr.c
> --- org/net/ipv6/ip6mr.c	2012-04-19 09:03:34.000000000 +0530
> +++ new/net/ipv6/ip6mr.c	2012-05-02 10:51:01.953110994 +0530
> @@ -937,8 +937,8 @@ static int mif6_add(struct net *net, str
>  			return -ENOBUFS;
>  		err = dev_set_allmulti(dev, 1);
>  		if (err) {
> -			unregister_netdevice(dev);
>  			dev_put(dev);
> +			unregister_netdevice(dev);
>  			return err;
>  		}
>  		break;
> 

This makes no difference to dev_put() before or after
unregister_netdevice() because we hold RTNL in mif6_add()

      reply	other threads:[~2012-05-02  7:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-02  6:09 [RFC] [PATCH] ipv6: Fix potential hang in mif6_add Krishna Kumar
2012-05-02  7:02 ` Eric Dumazet [this message]

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=1335942160.22133.51.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=krkumar2@in.ibm.com \
    --cc=netdev@vger.kernel.org \
    /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