]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
efd42bf1d851ed2742a40610bc9a3b54e298c549
[thirdparty/kernel/stable-queue.git] /
1 From foo@baz Mon Feb 29 14:33:50 PST 2016
2 From: Alexander Duyck <aduyck@mirantis.com>
3 Date: Tue, 9 Feb 2016 02:49:54 -0800
4 Subject: flow_dissector: Fix unaligned access in __skb_flow_dissector when used by eth_get_headlen
5
6 From: Alexander Duyck <aduyck@mirantis.com>
7
8 [ Upstream commit 461547f3158978c180d74484d58e82be9b8e7357 ]
9
10 This patch fixes an issue with unaligned accesses when using
11 eth_get_headlen on a page that was DMA aligned instead of being IP aligned.
12 The fact is when trying to check the length we don't need to be looking at
13 the flow label so we can reorder the checks to first check if we are
14 supposed to gather the flow label and then make the call to actually get
15 it.
16
17 v2: Updated path so that either STOP_AT_FLOW_LABEL or KEY_FLOW_LABEL can
18 cause us to check for the flow label.
19
20 Reported-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
21 Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
22 Signed-off-by: David S. Miller <davem@davemloft.net>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24 ---
25 net/core/flow_dissector.c | 9 ++++++---
26 1 file changed, 6 insertions(+), 3 deletions(-)
27
28 --- a/net/core/flow_dissector.c
29 +++ b/net/core/flow_dissector.c
30 @@ -208,7 +208,6 @@ ip:
31 case htons(ETH_P_IPV6): {
32 const struct ipv6hdr *iph;
33 struct ipv6hdr _iph;
34 - __be32 flow_label;
35
36 ipv6:
37 iph = __skb_header_pointer(skb, nhoff, sizeof(_iph), data, hlen, &_iph);
38 @@ -230,8 +229,12 @@ ipv6:
39 key_control->addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS;
40 }
41
42 - flow_label = ip6_flowlabel(iph);
43 - if (flow_label) {
44 + if ((dissector_uses_key(flow_dissector,
45 + FLOW_DISSECTOR_KEY_FLOW_LABEL) ||
46 + (flags & FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL)) &&
47 + ip6_flowlabel(iph)) {
48 + __be32 flow_label = ip6_flowlabel(iph);
49 +
50 if (dissector_uses_key(flow_dissector,
51 FLOW_DISSECTOR_KEY_FLOW_LABEL)) {
52 key_tags = skb_flow_dissector_target(flow_dissector,