]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.6.5/net_sched-fix-mirrored-packets-checksum.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.5 / net_sched-fix-mirrored-packets-checksum.patch
CommitLineData
23de047c
GKH
1From foo@baz Thu Jul 14 07:36:41 JST 2016
2From: WANG Cong <xiyou.wangcong@gmail.com>
3Date: Thu, 30 Jun 2016 10:15:22 -0700
4Subject: net_sched: fix mirrored packets checksum
5
6From: WANG Cong <xiyou.wangcong@gmail.com>
7
8[ Upstream commit 82a31b9231f02d9c1b7b290a46999d517b0d312a ]
9
10Similar to commit 9b368814b336 ("net: fix bridge multicast packet checksum validation")
11we need to fixup the checksum for CHECKSUM_COMPLETE when
12pushing skb on RX path. Otherwise we get similar splats.
13
14Cc: Jamal Hadi Salim <jhs@mojatatu.com>
15Cc: Tom Herbert <tom@herbertland.com>
16Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
17Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
18Signed-off-by: David S. Miller <davem@davemloft.net>
19Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20---
21 include/linux/skbuff.h | 19 +++++++++++++++++++
22 net/core/skbuff.c | 18 ------------------
23 net/sched/act_mirred.c | 2 +-
24 3 files changed, 20 insertions(+), 19 deletions(-)
25
26--- a/include/linux/skbuff.h
27+++ b/include/linux/skbuff.h
28@@ -2861,6 +2861,25 @@ static inline void skb_postpush_rcsum(st
29 }
30
31 /**
32+ * skb_push_rcsum - push skb and update receive checksum
33+ * @skb: buffer to update
34+ * @len: length of data pulled
35+ *
36+ * This function performs an skb_push on the packet and updates
37+ * the CHECKSUM_COMPLETE checksum. It should be used on
38+ * receive path processing instead of skb_push unless you know
39+ * that the checksum difference is zero (e.g., a valid IP header)
40+ * or you are setting ip_summed to CHECKSUM_NONE.
41+ */
42+static inline unsigned char *skb_push_rcsum(struct sk_buff *skb,
43+ unsigned int len)
44+{
45+ skb_push(skb, len);
46+ skb_postpush_rcsum(skb, skb->data, len);
47+ return skb->data;
48+}
49+
50+/**
51 * pskb_trim_rcsum - trim received skb and update checksum
52 * @skb: buffer to trim
53 * @len: new length
54--- a/net/core/skbuff.c
55+++ b/net/core/skbuff.c
56@@ -3016,24 +3016,6 @@ int skb_append_pagefrags(struct sk_buff
57 EXPORT_SYMBOL_GPL(skb_append_pagefrags);
58
59 /**
60- * skb_push_rcsum - push skb and update receive checksum
61- * @skb: buffer to update
62- * @len: length of data pulled
63- *
64- * This function performs an skb_push on the packet and updates
65- * the CHECKSUM_COMPLETE checksum. It should be used on
66- * receive path processing instead of skb_push unless you know
67- * that the checksum difference is zero (e.g., a valid IP header)
68- * or you are setting ip_summed to CHECKSUM_NONE.
69- */
70-static unsigned char *skb_push_rcsum(struct sk_buff *skb, unsigned len)
71-{
72- skb_push(skb, len);
73- skb_postpush_rcsum(skb, skb->data, len);
74- return skb->data;
75-}
76-
77-/**
78 * skb_pull_rcsum - pull skb and update receive checksum
79 * @skb: buffer to update
80 * @len: length of data pulled
81--- a/net/sched/act_mirred.c
82+++ b/net/sched/act_mirred.c
83@@ -180,7 +180,7 @@ static int tcf_mirred(struct sk_buff *sk
84
85 if (!(at & AT_EGRESS)) {
86 if (m->tcfm_ok_push)
87- skb_push(skb2, skb->mac_len);
88+ skb_push_rcsum(skb2, skb->mac_len);
89 }
90
91 /* mirror is always swallowed */