[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1488814795-5152-4-git-send-email-jiri@resnulli.us>
Date: Mon, 6 Mar 2017 16:39:53 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, tom@...bertland.com,
simon.horman@...ronome.com, eric.dumazet@...il.com,
dinan.gunawardena@...ronome.com, hadarh@...lanox.com, e@...g.me,
fgao@...ai8.com, mlxsw@...lanox.com
Subject: [patch net-next 3/5] flow_dissector: Fix GRE header error path
From: Jiri Pirko <jiri@...lanox.com>
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: Jiri Pirko <jiri@...lanox.com>
---
net/core/flow_dissector.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 8d01298..cefaf23 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -479,18 +479,18 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
/* Only look inside GRE without routing */
if (hdr->flags & GRE_ROUTING)
- break;
+ goto out_good;
/* Only look inside GRE for version 0 and 1 */
gre_ver = ntohs(hdr->flags & GRE_VERSION);
if (gre_ver > 1)
- break;
+ goto out_good;
proto = hdr->protocol;
if (gre_ver) {
/* Version1 must be PPTP, and check the flags */
if (!(proto == GRE_PROTO_PPP && (hdr->flags & GRE_KEY)))
- break;
+ goto out_good;
}
offset += sizeof(struct gre_base_hdr);
--
2.7.4
Powered by blists - more mailing lists