From patchwork Fri Jan 24 09:29:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 232951 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 991DBC35242 for ; Fri, 24 Jan 2020 11:23:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65E9720718 for ; Fri, 24 Jan 2020 11:23:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579865024; bh=spyU6i/kX4SzHR08lZ9KxFJ7/if87yKM48hJyDsFFBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HZRRfNRNKF+VsCI4rjEQaM9tq0YSbjCQ4Fpzzqm+vs76YAGeI85GbXuahd1VAcasM FRM6RAEu8+XhNFMCacRq0ABj90W77nt+GAV3ro0ZTlXI8369+BYp5j4ElplCpiZc1y OF46DwgyKBR7TyUDu9cTHc3Wb6vPdrP6vuxVLo1g= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390874AbgAXLXk (ORCPT ); Fri, 24 Jan 2020 06:23:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:36366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388604AbgAXLXk (ORCPT ); Fri, 24 Jan 2020 06:23:40 -0500 Received: from localhost (ip-213-127-102-57.ip.prioritytelecom.net [213.127.102.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 10A08206D4; Fri, 24 Jan 2020 11:23:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579865019; bh=spyU6i/kX4SzHR08lZ9KxFJ7/if87yKM48hJyDsFFBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oi+x2MTOaexDnUvifrINhsZibswQmAAddP0WKmkU32VzpTRC+y2Q+5ZafiDv4eq3+ 2yBjgO9RskE0s0dfAIzAk97EtETi8/j8J0xaf3x0w6TRxFxczVtwTq1ja4Hx5cA8xZ e4Gxq+W+FscZpcZBDqzpdON51VR91g55wZhnIMbM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, George Wilkie , David Ahern , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 416/639] mpls: fix warning with multi-label encap Date: Fri, 24 Jan 2020 10:29:46 +0100 Message-Id: <20200124093139.122397721@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124093047.008739095@linuxfoundation.org> References: <20200124093047.008739095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: George Wilkie [ Upstream commit 2f3f7d1fa0d1039b24a55d127ed190f196fc3e79 ] If you configure a route with multiple labels, e.g. ip route add 10.10.3.0/24 encap mpls 16/100 via 10.10.2.2 dev ens4 A warning is logged: kernel: [ 130.561819] netlink: 'ip': attribute type 1 has an invalid length. This happens because mpls_iptunnel_policy has set the type of MPLS_IPTUNNEL_DST to fixed size NLA_U32. Change it to a minimum size. nla_get_labels() does the remaining validation. Fixes: e3e4712ec096 ("mpls: ip tunnel support") Signed-off-by: George Wilkie Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/mpls/mpls_iptunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c index 94f53a9b7d1ae..faf6ef1b6a454 100644 --- a/net/mpls/mpls_iptunnel.c +++ b/net/mpls/mpls_iptunnel.c @@ -28,7 +28,7 @@ #include "internal.h" static const struct nla_policy mpls_iptunnel_policy[MPLS_IPTUNNEL_MAX + 1] = { - [MPLS_IPTUNNEL_DST] = { .type = NLA_U32 }, + [MPLS_IPTUNNEL_DST] = { .len = sizeof(u32) }, [MPLS_IPTUNNEL_TTL] = { .type = NLA_U8 }, };