From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cumulusnetworks.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n0+dypEw/mmwj4n5umZPIEkoXA5RHLYMjIpmLep+nuo=; b=ZjmYF+khrnKEBPqdQVUNPGyXaF8Q8XMnKbGzr7/Ld8CbbWboUaFUyxK5bZYjva+15F q1tzyl/AEbkpk3okxJK/TC74X/vwIHthZynf3rRanStYhyr6PRFziW5jXdEgcPgZ1x2Y ujKT7CvpBkTOzpWHWp8s8bqkVo/GXQlFBPHa4= From: Nikolay Aleksandrov Date: Tue, 7 Feb 2017 12:46:46 +0100 Message-Id: <1486468006-8080-1-git-send-email-nikolay@cumulusnetworks.com> In-Reply-To: References: Subject: [Bridge] [PATCH net-next] bridge: tunnel: fix attribute checks in br_parse_vlan_tunnel_info List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: netdev@vger.kernel.org Cc: Nikolay Aleksandrov , Colin Ian King , roopa@cumulusnetworks.com, bridge@lists.linux-foundation.org, "David S. Miller" 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 Signed-off-by: Nikolay Aleksandrov --- net/bridge/br_netlink_tunnel.c | 8 ++++---- 1 file 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) -- 2.1.4