[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210111130040.888957337@linuxfoundation.org>
Date: Mon, 11 Jan 2021 14:01:40 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
syzbot+f583ce3d4ddf9836b27a@...kaller.appspotmail.com,
William Tu <u9012063@...il.com>,
Lorenzo Bianconi <lorenzo.bianconi@...hat.com>,
Cong Wang <cong.wang@...edance.com>,
"David S. Miller" <davem@...emloft.net>
Subject: [PATCH 5.4 36/92] erspan: fix version 1 check in gre_parse_header()
From: Cong Wang <cong.wang@...edance.com>
[ Upstream commit 085c7c4e1c0e50d90b7d90f61a12e12b317a91e2 ]
Both version 0 and version 1 use ETH_P_ERSPAN, but version 0 does not
have an erspan header. So the check in gre_parse_header() is wrong,
we have to distinguish version 1 from version 0.
We can just check the gre header length like is_erspan_type1().
Fixes: cb73ee40b1b3 ("net: ip_gre: use erspan key field for tunnel lookup")
Reported-by: syzbot+f583ce3d4ddf9836b27a@...kaller.appspotmail.com
Cc: William Tu <u9012063@...il.com>
Cc: Lorenzo Bianconi <lorenzo.bianconi@...hat.com>
Signed-off-by: Cong Wang <cong.wang@...edance.com>
Signed-off-by: David S. Miller <davem@...emloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
net/ipv4/gre_demux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -128,7 +128,7 @@ int gre_parse_header(struct sk_buff *skb
* to 0 and sets the configured key in the
* inner erspan header field
*/
- if (greh->protocol == htons(ETH_P_ERSPAN) ||
+ if ((greh->protocol == htons(ETH_P_ERSPAN) && hdr_len != 4) ||
greh->protocol == htons(ETH_P_ERSPAN2)) {
struct erspan_base_hdr *ershdr;
Powered by blists - more mailing lists