Patrick McHardy pointed it out.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
if (dev_open(dev))
goto failure;
+ dev_hold(dev);
return dev;
failure:
err = dev_set_allmulti(dev, 1);
if (err) {
unregister_netdevice(dev);
+ dev_put(dev);
return err;
}
break;
dev = dev_get_by_index(&init_net, vifc->mif6c_pifi);
if (!dev)
return -EADDRNOTAVAIL;
- dev_put(dev);
err = dev_set_allmulti(dev, 1);
- if (err)
+ if (err) {
+ dev_put(dev);
return err;
+ }
break;
default:
return -EINVAL;
/* And finish update writing critical data */
write_lock_bh(&mrt_lock);
- dev_hold(dev);
v->dev = dev;
#ifdef CONFIG_IPV6_PIMSM_V2
if (v->flags & MIFF_REGISTER)