summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2013-08-05 18:25:54 +0300
committerDavid S. Miller <davem@davemloft.net>2013-08-05 11:02:48 -0700
commit1512747820367c8b3b8b72035f0f78c62f2bf1e9 (patch)
treeec96a777fc357c27d2c4e9ebec3c760c83eb5514 /drivers/net
parentf7b7a365331deb4553944a0b695dd6371614053a (diff)
downloadlinux-1512747820367c8b3b8b72035f0f78c62f2bf1e9.tar.gz
linux-1512747820367c8b3b8b72035f0f78c62f2bf1e9.tar.bz2
linux-1512747820367c8b3b8b72035f0f78c62f2bf1e9.zip
macvlan: validate flags
commit df8ef8f3aaa6692970a436204c4429210addb23a macvlan: add FDB bridge ops and macvlan flags added a flags field to macvlan, which can be controlled from userspace. The idea is to make the interface future-proof so we can add flags and not new fields. However, flags value isn't validated, as a result, userspace can't detect which flags are supported. Cc: "David S. Miller" <davem@davemloft.net> Cc: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/macvlan.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index d0f9c2fd1d4f..16b43bf544b7 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -739,6 +739,10 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[])
return -EADDRNOTAVAIL;
}
+ if (data && data[IFLA_MACVLAN_FLAGS] &&
+ nla_get_u16(data[IFLA_MACVLAN_FLAGS]) & ~MACVLAN_FLAG_NOPROMISC)
+ return -EINVAL;
+
if (data && data[IFLA_MACVLAN_MODE]) {
switch (nla_get_u32(data[IFLA_MACVLAN_MODE])) {
case MACVLAN_MODE_PRIVATE: