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