netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Justin Cormack <justin@myriabit.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next] fix missing copy_from_user in macvtap
Date: Wed, 13 May 2015 19:19:02 +0100	[thread overview]
Message-ID: <1431541142.3278.10.camel@myriabit.com> (raw)
In-Reply-To: <20150513.120956.970928701180963590.davem@davemloft.net>

Fix missing copy_from_user in macvtap SIOCSIFHWADDR ioctl.

Signed-off-by: Justin Cormack <justin@netbsd.org>

diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index c8a2389..483afb1 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -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;
 
@@ -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;

  reply	other threads:[~2015-05-13 18:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 15:56 [PATCH] macvtap add missing ioctls Justin Cormack
2015-05-09 21:40 ` David Miller
2015-05-10  9:15   ` [PATCH v2] " Justin Cormack
2015-05-10 12:50     ` [PATCH v3] macvtap add missing ioctls - fix wrapping Justin Cormack
2015-05-11 17:49       ` David Miller
2015-05-11 19:00         ` [PATCH v4] " Justin Cormack
2015-05-13  3:01           ` David Miller
2015-05-13 10:06             ` Justin Cormack
2015-05-13 16:06               ` David Miller
2015-05-13 11:35             ` [PATCH v5] macvtap add missing ioctls Justin Cormack
2015-05-13 16:09               ` David Miller
2015-05-13 18:19                 ` Justin Cormack [this message]
2015-05-13 18:21                   ` [PATCH net-next] fix missing copy_from_user in macvtap David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1431541142.3278.10.camel@myriabit.com \
    --to=justin@myriabit.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).