Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb580ad6 authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller
Browse files

bridge: tunnel: fix attribute checks in br_parse_vlan_tunnel_info



These checks should go after the attributes have been parsed otherwise
we're using tb uninitialized.

Fixes: efa5356b ("bridge: per vlan dst_metadata netlink support")
Reported-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1f02b5f4
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -229,15 +229,15 @@ int br_parse_vlan_tunnel_info(struct nlattr *attr,

	memset(tinfo, 0, sizeof(*tinfo));

	if (!tb[IFLA_BRIDGE_VLAN_TUNNEL_ID] ||
	    !tb[IFLA_BRIDGE_VLAN_TUNNEL_VID])
		return -EINVAL;

	err = nla_parse_nested(tb, IFLA_BRIDGE_VLAN_TUNNEL_MAX,
			       attr, vlan_tunnel_policy);
	if (err < 0)
		return err;

	if (!tb[IFLA_BRIDGE_VLAN_TUNNEL_ID] ||
	    !tb[IFLA_BRIDGE_VLAN_TUNNEL_VID])
		return -EINVAL;

	tun_id = nla_get_u32(tb[IFLA_BRIDGE_VLAN_TUNNEL_ID]);
	vid = nla_get_u16(tb[IFLA_BRIDGE_VLAN_TUNNEL_VID]);
	if (vid >= VLAN_VID_MASK)