David S. Miller [off-list ref] wrote:
Maybe new code should be something like:
if (dev && dev != &loopback_dev) {
You want
if (dev) {
here.
dev_put(dev);
in6_dev_put(idev);
}
dev = &loopback_dev;
dev_hold(dev);
idev = in6_dev_get(dev);
if (!idev) {
err = -ENODEV;
goto out;
}
What do you think?
Yes this would work. But I think Yoshifuji-san is trying to avoid the
unnecessary put/get in the case where dev is already loopback_dev.
So something like this might work:
if (dev != &loopback_dev) {
if (dev) {
dev_put(dev);
in6_dev_put(idev);
}
...
}
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt