]> git.baikalelectronics.ru Git - kernel.git/commitdiff
macvlan: validate flags
authorMichael S. Tsirkin <mst@redhat.com>
Mon, 5 Aug 2013 15:25:54 +0000 (18:25 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Aug 2013 18:02:48 +0000 (11:02 -0700)
commit a3e17141dde26b498f4a33e8139dfe0fc2e874d2
    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>
drivers/net/macvlan.c

index d0f9c2fd1d4fdaa06110d394411f48bb5f8874bb..16b43bf544b74dd3ee72599f56f429ca2dea8851 100644 (file)
@@ -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: