Commit 74447771 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[IPV4]: Replace explicit dev->refcount bumps with dev_hold.

parent c76cc6e2
......@@ -115,9 +115,9 @@ struct net_device * ip_dev_find(u32 addr)
if (res.type != RTN_LOCAL)
goto out;
dev = FIB_RES_DEV(res);
if (dev)
atomic_inc(&dev->refcnt);
if (dev)
dev_hold(dev);
out:
fib_res_put(&res);
return dev;
......
......@@ -406,7 +406,7 @@ static int fib_check_nh(const struct rtmsg *r, struct fib_info *fi, struct fib_n
if (!(dev->flags&IFF_UP))
return -ENETDOWN;
nh->nh_dev = dev;
atomic_inc(&dev->refcnt);
dev_hold(dev);
nh->nh_scope = RT_SCOPE_LINK;
return 0;
}
......@@ -429,7 +429,7 @@ static int fib_check_nh(const struct rtmsg *r, struct fib_info *fi, struct fib_n
nh->nh_oif = FIB_RES_OIF(res);
if ((nh->nh_dev = FIB_RES_DEV(res)) == NULL)
goto out;
atomic_inc(&nh->nh_dev->refcnt);
dev_hold(nh->nh_dev);
err = -ENETDOWN;
if (!(nh->nh_dev->flags & IFF_UP))
goto out;
......@@ -451,7 +451,7 @@ static int fib_check_nh(const struct rtmsg *r, struct fib_info *fi, struct fib_n
return -ENETDOWN;
}
nh->nh_dev = in_dev->dev;
atomic_inc(&nh->nh_dev->refcnt);
dev_hold(nh->nh_dev);
nh->nh_scope = RT_SCOPE_HOST;
in_dev_put(in_dev);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment