Netdev List
 help / color / mirror / Atom feed
From: Krishna Kumar <krkumar2@in.ibm.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Krishna Kumar <krkumar2@in.ibm.com>
Subject: [RFC] [PATCH] ipv6: Fix potential hang in mif6_add
Date: Wed, 02 May 2012 11:39:57 +0530	[thread overview]
Message-ID: <20120502060957.30368.34595.sendpatchset@localhost.localdomain> (raw)

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;

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-02  6:09 Krishna Kumar [this message]
2012-05-02  7:02 ` [RFC] [PATCH] ipv6: Fix potential hang in mif6_add 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=20120502060957.30368.34595.sendpatchset@localhost.localdomain \
    --to=krkumar2@in.ibm.com \
    --cc=davem@davemloft.net \
    --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