diff options
author | 2019-12-05 19:39:02 -0800 | |
---|---|---|
committer | 2020-01-31 16:51:13 -0500 | |
commit | c5eba532e3086f4526d88fcde98d8dfcc62edeba (patch) | |
tree | 959ac0b7bee99381ee8aa52416756633c62aa155 | |
parent | 8477c46262fa44c04a3efd591b571eae094f6433 (diff) | |
download | linux-yocto-c5eba532e3086f4526d88fcde98d8dfcc62edeba.tar.gz linux-yocto-c5eba532e3086f4526d88fcde98d8dfcc62edeba.tar.bz2 linux-yocto-c5eba532e3086f4526d88fcde98d8dfcc62edeba.zip |
gre: refetch erspan header from skb->data after pskb_may_pull()
commit 0e4940928c26527ce8f97237fef4c8a91cd34207 upstream.
After pskb_may_pull() we should always refetch the header
pointers from the skb->data in case it got reallocated.
In gre_parse_header(), the erspan header is still fetched
from the 'options' pointer which is fetched before
pskb_may_pull().
Found this during code review of a KMSAN bug report.
Fixes: cb73ee40b1b3 ("net: ip_gre: use erspan key field for tunnel lookup")
Cc: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: William Tu <u9012063@gmail.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r-- | net/ipv4/gre_demux.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c index 293acfb36376..2d9fd83a408f 100644 --- a/net/ipv4/gre_demux.c +++ b/net/ipv4/gre_demux.c @@ -127,7 +127,7 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi, if (!pskb_may_pull(skb, nhs + hdr_len + sizeof(*ershdr))) return -EINVAL; - ershdr = (struct erspan_base_hdr *)options; + ershdr = (struct erspan_base_hdr *)(skb->data + nhs + hdr_len); tpi->key = cpu_to_be32(get_session_id(ershdr)); } |