netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] bridge: netlink: check vlan_default_pvid range
@ 2017-05-17  7:29 Tobias Jungel
  2017-05-17 16:12 ` Sabrina Dubroca
  2017-05-18 14:15 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Tobias Jungel @ 2017-05-17  7:29 UTC (permalink / raw)
  To: Sabrina Dubroca, Nikolay Aleksandrov, 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 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>
---
 net/bridge/br_netlink.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index c5ce774..574f788 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[])
 			return -EPROTONOSUPPORT;
 		}
 	}
+
+	if (data[IFLA_BR_VLAN_DEFAULT_PVID]) {
+		__u16 defpvid = nla_get_u16(data[IFLA_BR_VLAN_DEFAULT_PVID]);
+
+		if (defpvid >= VLAN_VID_MASK)
+			return -EINVAL;
+	}
 #endif
 
 	return 0;
-- 
2.9.4

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

* Re: [PATCH v4] bridge: netlink: check vlan_default_pvid range
  2017-05-17  7:29 [PATCH v4] bridge: netlink: check vlan_default_pvid range Tobias Jungel
@ 2017-05-17 16:12 ` Sabrina Dubroca
  2017-05-18 14:15 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Sabrina Dubroca @ 2017-05-17 16:12 UTC (permalink / raw)
  To: Tobias Jungel
  Cc: Nikolay Aleksandrov, Stephen Hemminger, David S. Miller, netdev

2017-05-17, 09:29:12 +0200, Tobias Jungel wrote:
> 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>


Thanks,

-- 
Sabrina

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

* Re: [PATCH v4] bridge: netlink: check vlan_default_pvid range
  2017-05-17  7:29 [PATCH v4] bridge: netlink: check vlan_default_pvid range Tobias Jungel
  2017-05-17 16:12 ` Sabrina Dubroca
@ 2017-05-18 14:15 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-05-18 14:15 UTC (permalink / raw)
  To: tobias.jungel; +Cc: sd, nikolay, stephen, netdev

From: Tobias Jungel <tobias.jungel@bisdn.de>
Date: Wed, 17 May 2017 09:29:12 +0200

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

Applied and queued up for -stable, thank you.

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-17  7:29 [PATCH v4] bridge: netlink: check vlan_default_pvid range Tobias Jungel
2017-05-17 16:12 ` Sabrina Dubroca
2017-05-18 14:15 ` David Miller

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