* [RFC] [PATCH] ipv6: Fix potential hang in mif6_add
@ 2012-05-02 6:09 Krishna Kumar
2012-05-02 7:02 ` Eric Dumazet
0 siblings, 1 reply; 2+ messages in thread
From: Krishna Kumar @ 2012-05-02 6:09 UTC (permalink / raw)
To: davem; +Cc: netdev, Krishna Kumar
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;
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [RFC] [PATCH] ipv6: Fix potential hang in mif6_add
2012-05-02 6:09 [RFC] [PATCH] ipv6: Fix potential hang in mif6_add Krishna Kumar
@ 2012-05-02 7:02 ` Eric Dumazet
0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2012-05-02 7:02 UTC (permalink / raw)
To: Krishna Kumar; +Cc: davem, netdev
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()
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-02 7:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-02 6:09 [RFC] [PATCH] ipv6: Fix potential hang in mif6_add Krishna Kumar
2012-05-02 7:02 ` Eric Dumazet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox