mpls: fix warning with multi-label encap
authorGeorge Wilkie <gwilkie@vyatta.att-mail.com>
Fri, 7 Jun 2019 10:49:41 +0000 (11:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jan 2020 13:50:54 +0000 (14:50 +0100)
commit5389e1b4c92e3ae02892aa8fbf4a26192c04bf91
tree24f227b8394e56d8bee1b8652b7a3cf604c10ac2
parentae8ff9c564ae5d3e4fee0c41f53dec70fa8bdc77
mpls: fix warning with multi-label encap

[ 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 <gwilkie@vyatta.att-mail.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/mpls/mpls_iptunnel.c