Skip to content

Commit

Permalink
fix missing copy_from_user in macvtap
Browse files Browse the repository at this point in the history
Fix missing copy_from_user in macvtap SIOCSIFHWADDR ioctl.

Signed-off-by: Justin Cormack <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
justincormack authored and davem330 committed May 13, 2015
1 parent 42275bd commit 7f460d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/macvtap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,7 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd,
unsigned int __user *up = argp;
unsigned short u;
int __user *sp = argp;
struct sockaddr sa;
int s;
int ret;

Expand Down Expand Up @@ -1119,13 +1120,15 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd,
return ret;

case SIOCSIFHWADDR:
if (copy_from_user(&sa, &ifr->ifr_hwaddr, sizeof(sa)))
return -EFAULT;
rtnl_lock();
vlan = macvtap_get_vlan(q);
if (!vlan) {
rtnl_unlock();
return -ENOLINK;
}
ret = dev_set_mac_address(vlan->dev, &ifr->ifr_hwaddr);
ret = dev_set_mac_address(vlan->dev, &sa);
macvtap_put_vlan(vlan);
rtnl_unlock();
return ret;
Expand Down

0 comments on commit 7f460d3

Please sign in to comment.