Commit a09a624a authored by Steven Whitehouse's avatar Steven Whitehouse Committed by David S. Miller

[DECNET]: Decnet not obeying netdev locking (from shemminger@osdl.org).

parent 5367cd16
......@@ -561,7 +561,6 @@ int dn_dev_ioctl(unsigned int cmd, void *arg)
struct dn_dev *dn_db;
struct net_device *dev;
struct dn_ifaddr *ifa = NULL, **ifap = NULL;
int exclusive = 0;
int ret = 0;
if (copy_from_user(ifr, arg, DN_IFREQ_SIZE))
......@@ -580,13 +579,13 @@ int dn_dev_ioctl(unsigned int cmd, void *arg)
return -EACCES;
if (sdn->sdn_family != AF_DECnet)
return -EINVAL;
rtnl_lock();
exclusive = 1;
break;
default:
return -EINVAL;
}
rtnl_lock();
if ((dev = __dev_get_by_name(ifr->ifr_name)) == NULL) {
ret = -ENODEV;
goto done;
......@@ -626,15 +625,13 @@ int dn_dev_ioctl(unsigned int cmd, void *arg)
ret = dn_dev_set_ifa(dev, ifa);
}
done:
if (exclusive)
rtnl_unlock();
return ret;
rarok:
if (copy_to_user(arg, ifr, DN_IFREQ_SIZE))
return -EFAULT;
return 0;
ret = -EFAULT;
goto done;
}
static struct dn_dev *dn_dev_by_index(int ifindex)
......
......@@ -173,9 +173,11 @@ int dn_fib_rtm_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
memcpy(new_r->r_ifname, RTA_DATA(rta[RTA_IIF-1]), IFNAMSIZ);
new_r->r_ifname[IFNAMSIZ-1] = 0;
new_r->r_ifindex = -1;
dev = __dev_get_by_name(new_r->r_ifname);
if (dev)
dev = dev_get_by_name(new_r->r_ifname);
if (dev) {
new_r->r_ifindex = dev->ifindex;
dev_put(dev);
}
}
rp = &dn_fib_rules;
......
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