ipmr: missing dev_put() on error path in vif_add()
authorDan Carpenter <error27@gmail.com>
Wed, 11 Nov 2009 02:03:54 +0000 (02:03 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 14 Nov 2009 03:56:54 +0000 (19:56 -0800)
The other error paths in front of this one have a dev_put() but this one
got missed.

Found by smatch static checker.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Wang Chen <ellre923@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ipmr.c

index 630a56df7b47ee80c9c77dcbb62048dc73ed9fc5..99508d66a64227fd532718486fa9eed924963e26 100644 (file)
@@ -483,8 +483,10 @@ static int vif_add(struct net *net, struct vifctl *vifc, int mrtsock)
                return -EINVAL;
        }
 
-       if ((in_dev = __in_dev_get_rtnl(dev)) == NULL)
+       if ((in_dev = __in_dev_get_rtnl(dev)) == NULL) {
+               dev_put(dev);
                return -EADDRNOTAVAIL;
+       }
        IPV4_DEVCONF(in_dev->cnf, MC_FORWARDING)++;
        ip_rt_multicast_event(in_dev);