diff options
author | Tobias Jungel <tobias.jungel@bisdn.de> | 2017-05-17 03:29:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-18 10:15:00 -0400 |
commit | a285860211bf257b0e6d522dac6006794be348af (patch) | |
tree | f25f67fb0493c4280e3ec0cba341089f90db2524 | |
parent | 47ab37a19a8112670e63474016d5fbf86bc8737f (diff) |
bridge: netlink: check vlan_default_pvid range
Currently it is allowed to set the default pvid of a bridge to a value
above VLAN_VID_MASK (0xfff). This patch adds a check to br_validate and
returns -EINVAL in case the pvid is out of bounds.
Reproduce by calling:
[root@test ~]# ip l a type bridge
[root@test ~]# ip l a type dummy
[root@test ~]# ip l s bridge0 type bridge vlan_filtering 1
[root@test ~]# ip l s bridge0 type bridge vlan_default_pvid 9999
[root@test ~]# ip l s dummy0 master bridge0
[root@test ~]# bridge vlan
port vlan ids
bridge0 9999 PVID Egress Untagged
dummy0 9999 PVID Egress Untagged
Fixes: 0f963b7592ef ("bridge: netlink: add support for default_pvid")
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: Tobias Jungel <tobias.jungel@bisdn.de>
Acked-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/bridge/br_netlink.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index c5ce7745b230..574f78824d8a 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -835,6 +835,13 @@ static int br_validate(struct nlattr *tb[], struct nlattr *data[]) | |||
835 | return -EPROTONOSUPPORT; | 835 | return -EPROTONOSUPPORT; |
836 | } | 836 | } |
837 | } | 837 | } |
838 | |||
839 | if (data[IFLA_BR_VLAN_DEFAULT_PVID]) { | ||
840 | __u16 defpvid = nla_get_u16(data[IFLA_BR_VLAN_DEFAULT_PVID]); | ||
841 | |||
842 | if (defpvid >= VLAN_VID_MASK) | ||
843 | return -EINVAL; | ||
844 | } | ||
838 | #endif | 845 | #endif |
839 | 846 | ||
840 | return 0; | 847 | return 0; |