switchdev: enforce no pvid flag in vlan ranges
authorNikolay Aleksandrov <[email protected]>
Mon, 12 Oct 2015 12:01:39 +0000 (14:01 +0200)
committerDavid S. Miller <[email protected]>
Tue, 13 Oct 2015 11:41:40 +0000 (04:41 -0700)
We shouldn't allow BRIDGE_VLAN_INFO_PVID flag in VLAN ranges.

Signed-off-by: Nikolay Aleksandrov <[email protected]>
Acked-by: Elad Raz <[email protected]>
Acked-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/switchdev/switchdev.c

index 7a9ab90363be1205dcff102fa486cd5698569e99..b8aaf820ef65de3e4473edbeaf68958a10bb028e 100644 (file)
@@ -727,6 +727,9 @@ static int switchdev_port_br_afspec(struct net_device *dev,
                        if (vlan.vid_begin)
                                return -EINVAL;
                        vlan.vid_begin = vinfo->vid;
+                       /* don't allow range of pvids */
+                       if (vlan.flags & BRIDGE_VLAN_INFO_PVID)
+                               return -EINVAL;
                } else if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END) {
                        if (!vlan.vid_begin)
                                return -EINVAL;