summaryrefslogtreecommitdiff
path: root/net/bridge/br_netlink_tunnel.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>2017-02-07 14:46:46 +0300
committerDavid S. Miller <davem@davemloft.net>2017-02-07 22:05:30 +0300
commitbb580ad698aeb4e5455d701c228c50355f84c056 (patch)
treeb12d3d016cb536db67ab242539b7c9c5b10d9a92 /net/bridge/br_netlink_tunnel.c
parent1f02b5f42f53af516c4f5f747390e66d7a8f0bfe (diff)
downloadlinux-bb580ad698aeb4e5455d701c228c50355f84c056.tar.xz
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: efa5356b0d97 ("bridge: per vlan dst_metadata netlink support") Reported-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_netlink_tunnel.c')
-rw-r--r--net/bridge/br_netlink_tunnel.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/bridge/br_netlink_tunnel.c b/net/bridge/br_netlink_tunnel.c
index 99c68012c9d4..62eaf750bd9e 100644
--- a/net/bridge/br_netlink_tunnel.c
+++ b/net/bridge/br_netlink_tunnel.c
@@ -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)