ip_gre: fix parsing gre header in ipgre_err
authorHaishuang Yan <yanhaishuang@cmss.chinamobile.com>
Fri, 14 Sep 2018 04:26:47 +0000 (12:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Nov 2019 17:00:02 +0000 (18:00 +0100)
commit592f63897b86cac8782b6b28fcc92973c28a3ea8
tree3a32452bce4c9fd98121f655e653941dd55d6692
parente32819f088faba6f52251f0a8dafb1b52eebb93b
ip_gre: fix parsing gre header in ipgre_err

[ Upstream commit b0350d51f001e6edc13ee4f253b98b50b05dd401 ]

gre_parse_header stops parsing when csum_err is encountered, which means
tpi->key is undefined and ip_tunnel_lookup will return NULL improperly.

This patch introduce a NULL pointer as csum_err parameter. Even when
csum_err is encountered, it won't return error and continue parsing gre
header as expected.

Fixes: 9f57c67c379d ("gre: Remove support for sharing GRE protocol hook.")
Reported-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/gre_demux.c
net/ipv4/ip_gre.c