netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bridge: netlink: check vlan_default_pvid range
@ 2017-05-15 11:08 Tobias Jungel
  2017-05-15 12:01 ` Sabrina Dubroca
  2017-05-15 12:05 ` Nikolay Aleksandrov
  0 siblings, 2 replies; 7+ messages in thread
From: Tobias Jungel @ 2017-05-15 11:08 UTC (permalink / raw)
  To: Stephen Hemminger, David S. Miller, netdev

Currently it is allowed to set the default pvid of a bridge to a value
above VLAN_VID_MASK (0xfff). This patch checks the passed pvid and
disables the pvid in case it 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
---
 net/bridge/br_vlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index b838213..e363d75 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -820,7 +820,7 @@ int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid)
 	int err = 0;
 	unsigned long *changed;
 
-	if (!pvid) {
+	if (!pvid || pvid >= VLAN_VID_MASK) {
 		br_vlan_disable_default_pvid(br);
 		return 0;
 	}
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-05-15 14:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-15 11:08 [PATCH] bridge: netlink: check vlan_default_pvid range Tobias Jungel
2017-05-15 12:01 ` Sabrina Dubroca
2017-05-15 13:21   ` Tobias Jungel
2017-05-15 13:29     ` Nikolay Aleksandrov
2017-05-15 13:31       ` Nikolay Aleksandrov
2017-05-15 14:38         ` Tobias Jungel
2017-05-15 12:05 ` Nikolay Aleksandrov

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).