Commit d5774b93 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

flow_dissector: Fix GRE header error path

Now, when an unexpected element in the GRE header appears, we break so
the l4 ports are processed. But since the ports are processed
unconditionally, there will be certainly random values dissected. Fix
this by just bailing out in such situations.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4a5d6c8b
...@@ -479,18 +479,18 @@ bool __skb_flow_dissect(const struct sk_buff *skb, ...@@ -479,18 +479,18 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
/* Only look inside GRE without routing */ /* Only look inside GRE without routing */
if (hdr->flags & GRE_ROUTING) if (hdr->flags & GRE_ROUTING)
break; goto out_good;
/* Only look inside GRE for version 0 and 1 */ /* Only look inside GRE for version 0 and 1 */
gre_ver = ntohs(hdr->flags & GRE_VERSION); gre_ver = ntohs(hdr->flags & GRE_VERSION);
if (gre_ver > 1) if (gre_ver > 1)
break; goto out_good;
proto = hdr->protocol; proto = hdr->protocol;
if (gre_ver) { if (gre_ver) {
/* Version1 must be PPTP, and check the flags */ /* Version1 must be PPTP, and check the flags */
if (!(proto == GRE_PROTO_PPP && (hdr->flags & GRE_KEY))) if (!(proto == GRE_PROTO_PPP && (hdr->flags & GRE_KEY)))
break; goto out_good;
} }
offset += sizeof(struct gre_base_hdr); offset += sizeof(struct gre_base_hdr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment