* [Patch net] erspan: fix version 1 check in gre_parse_header()
@ 2020-12-26 23:44 Cong Wang
2020-12-28 23:01 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2020-12-26 23:44 UTC (permalink / raw)
To: netdev
Cc: Cong Wang, syzbot+f583ce3d4ddf9836b27a, William Tu, Lorenzo Bianconi
From: Cong Wang <cong.wang@bytedance.com>
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@syzkaller.appspotmail.com
Cc: William Tu <u9012063@gmail.com>
Cc: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Cong Wang <cong.wang@bytedance.com>
---
net/ipv4/gre_demux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index 66fdbfe5447c..5d1e6fe9d838 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -128,7 +128,7 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
* 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;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch net] erspan: fix version 1 check in gre_parse_header()
2020-12-26 23:44 [Patch net] erspan: fix version 1 check in gre_parse_header() Cong Wang
@ 2020-12-28 23:01 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-12-28 23:01 UTC (permalink / raw)
To: xiyou.wangcong
Cc: netdev, cong.wang, syzbot+f583ce3d4ddf9836b27a, u9012063,
lorenzo.bianconi
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Sat, 26 Dec 2020 15:44:53 -0800
> From: Cong Wang <cong.wang@bytedance.com>
>
> 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@syzkaller.appspotmail.com
> Cc: William Tu <u9012063@gmail.com>
> Cc: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-28 23:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-26 23:44 [Patch net] erspan: fix version 1 check in gre_parse_header() Cong Wang
2020-12-28 23:01 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.