fix missing copy_from_user in macvtap
Fix missing copy_from_user in macvtap SIOCSIFHWADDR ioctl. Signed-off-by: Justin Cormack <justin@netbsd.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
42275bd8fc
commit
7f460d30c8
|
@ -1006,6 +1006,7 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd,
|
||||||
unsigned int __user *up = argp;
|
unsigned int __user *up = argp;
|
||||||
unsigned short u;
|
unsigned short u;
|
||||||
int __user *sp = argp;
|
int __user *sp = argp;
|
||||||
|
struct sockaddr sa;
|
||||||
int s;
|
int s;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -1119,13 +1120,15 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd,
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
case SIOCSIFHWADDR:
|
case SIOCSIFHWADDR:
|
||||||
|
if (copy_from_user(&sa, &ifr->ifr_hwaddr, sizeof(sa)))
|
||||||
|
return -EFAULT;
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
vlan = macvtap_get_vlan(q);
|
vlan = macvtap_get_vlan(q);
|
||||||
if (!vlan) {
|
if (!vlan) {
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
return -ENOLINK;
|
return -ENOLINK;
|
||||||
}
|
}
|
||||||
ret = dev_set_mac_address(vlan->dev, &ifr->ifr_hwaddr);
|
ret = dev_set_mac_address(vlan->dev, &sa);
|
||||||
macvtap_put_vlan(vlan);
|
macvtap_put_vlan(vlan);
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue