[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <520dba6c-70c3-f2a4-d5e5-67253ecf5a29@cumulusnetworks.com>
Date: Tue, 16 May 2017 19:23:07 +0300
From: Nikolay Aleksandrov <nikolay@...ulusnetworks.com>
To: Tobias Jungel <tobias.jungel@...dn.de>,
Sabrina Dubroca <sd@...asysnail.net>,
Stephen Hemminger <stephen@...workplumber.org>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH v3] bridge: netlink: check vlan_default_pvid range
On 5/16/17 11:48 AM, 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@...t ~]# ip l a type bridge
> [root@...t ~]# ip l a type dummy
> [root@...t ~]# ip l s bridge0 type bridge vlan_filtering 1
> [root@...t ~]# ip l s bridge0 type bridge vlan_default_pvid 9999
> [root@...t ~]# ip l s dummy0 master bridge0
> [root@...t ~]# bridge vlan
> port vlan ids
> bridge0 9999 PVID Egress Untagged
>
> dummy0 9999 PVID Egress Untagged
>
> Fixes: 0f963b7592ef ("bridge: netlink: add support for default_pvid")
> Signed-off-by: Tobias Jungel <tobias.jungel@...dn.de>
> ---
> net/bridge/br_netlink.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> index c5ce774..47cb95b 100644
> --- a/net/bridge/br_netlink.c
> +++ b/net/bridge/br_netlink.c
> @@ -835,6 +835,12 @@ 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]);
Please leave a blank line between the variable definition and the rest.
> + if (defpvid >= VLAN_VID_MASK)
> + return -EINVAL;
> + }
> #endif
>
> return 0;
>
This version looks good to me, with the above stylistic issue fixed feel
free to add my:
Acked-by: Nikolay Aleksandrov <nikolay@...ulusnetworks.com>
Thanks!
Powered by blists - more mailing lists