summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-06-12 19:31:32 -0700
committerDavid S. Miller <davem@davemloft.net>2015-06-12 21:58:49 -0700
commit1e98a0f08abddde87f0f93237f10629ecb4880ef (patch)
treed076e4b8b38b5cc82e865986ceb736585dca2374 /net/core
parent5b173cf92729b02ff8207abd85bfcbbef3443b94 (diff)
downloadlwn-1e98a0f08abddde87f0f93237f10629ecb4880ef.tar.gz
lwn-1e98a0f08abddde87f0f93237f10629ecb4880ef.zip
flow_dissector: fix ipv6 dst, hop-by-hop and routing ext hdrs
__skb_header_pointer() returns a pointer that must be checked. Fixes infinite loop reported by Alexei, and add __must_check to catch these errors earlier. Fixes: 6a74fcf426f5 ("flow_dissector: add support for dst, hop-by-hop and routing ext hdrs") Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com> Tested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Tom Herbert <tom@herbertland.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/flow_dissector.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 22e4dffa0c8b..476e5dda59e1 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -394,9 +394,11 @@ ip_proto_again:
opthdr = __skb_header_pointer(skb, nhoff, sizeof(_opthdr),
data, hlen, &_opthdr);
+ if (!opthdr)
+ return false;
- ip_proto = _opthdr[0];
- nhoff += (_opthdr[1] + 1) << 3;
+ ip_proto = opthdr[0];
+ nhoff += (opthdr[1] + 1) << 3;
goto ip_proto_again;
}