b3f105be029372620d1d9bedb76f709263a6faf1
[openwrt/staging/wigyori.git] / target / linux / brcm2708 / patches-4.4 / 0222-net-fix-bridge-multicast-packet-checksum-validation.patch
1 From 966e306c7690f118bedf2f5de94e22e487bd39ec Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
3 Date: Wed, 24 Feb 2016 04:21:42 +0100
4 Subject: [PATCH 222/232] net: fix bridge multicast packet checksum validation
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 We need to update the skb->csum after pulling the skb, otherwise
10 an unnecessary checksum (re)computation can ocure for IGMP/MLD packets
11 in the bridge code. Additionally this fixes the following splats for
12 network devices / bridge ports with support for and enabled RX checksum
13 offloading:
14
15 [...]
16 [ 43.986968] eth0: hw csum failure
17 [ 43.990344] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 4.4.0 #2
18 [ 43.996193] Hardware name: BCM2709
19 [ 43.999647] [<800204e0>] (unwind_backtrace) from [<8001cf14>] (show_stack+0x10/0x14)
20 [ 44.007432] [<8001cf14>] (show_stack) from [<801ab614>] (dump_stack+0x80/0x90)
21 [ 44.014695] [<801ab614>] (dump_stack) from [<802e4548>] (__skb_checksum_complete+0x6c/0xac)
22 [ 44.023090] [<802e4548>] (__skb_checksum_complete) from [<803a055c>] (ipv6_mc_validate_checksum+0x104/0x178)
23 [ 44.032959] [<803a055c>] (ipv6_mc_validate_checksum) from [<802e111c>] (skb_checksum_trimmed+0x130/0x188)
24 [ 44.042565] [<802e111c>] (skb_checksum_trimmed) from [<803a06e8>] (ipv6_mc_check_mld+0x118/0x338)
25 [ 44.051501] [<803a06e8>] (ipv6_mc_check_mld) from [<803b2c98>] (br_multicast_rcv+0x5dc/0xd00)
26 [ 44.060077] [<803b2c98>] (br_multicast_rcv) from [<803aa510>] (br_handle_frame_finish+0xac/0x51c)
27 [...]
28
29 Fixes: 9afd85c9e455 ("net: Export IGMP/MLD message validation code")
30 Reported-by: Álvaro Fernández Rojas <noltari@gmail.com>
31 Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
32 Signed-off-by: David S. Miller <davem@davemloft.net>
33 ---
34 net/core/skbuff.c | 22 ++++++++++++++++++++--
35 1 file changed, 20 insertions(+), 2 deletions(-)
36
37 --- a/net/core/skbuff.c
38 +++ b/net/core/skbuff.c
39 @@ -2965,6 +2965,24 @@ int skb_append_pagefrags(struct sk_buff
40 EXPORT_SYMBOL_GPL(skb_append_pagefrags);
41
42 /**
43 + * skb_push_rcsum - push skb and update receive checksum
44 + * @skb: buffer to update
45 + * @len: length of data pulled
46 + *
47 + * This function performs an skb_push on the packet and updates
48 + * the CHECKSUM_COMPLETE checksum. It should be used on
49 + * receive path processing instead of skb_push unless you know
50 + * that the checksum difference is zero (e.g., a valid IP header)
51 + * or you are setting ip_summed to CHECKSUM_NONE.
52 + */
53 +static unsigned char *skb_push_rcsum(struct sk_buff *skb, unsigned len)
54 +{
55 + skb_push(skb, len);
56 + skb_postpush_rcsum(skb, skb->data, len);
57 + return skb->data;
58 +}
59 +
60 +/**
61 * skb_pull_rcsum - pull skb and update receive checksum
62 * @skb: buffer to update
63 * @len: length of data pulled
64 @@ -4101,9 +4119,9 @@ struct sk_buff *skb_checksum_trimmed(str
65 if (!pskb_may_pull(skb_chk, offset))
66 goto err;
67
68 - __skb_pull(skb_chk, offset);
69 + skb_pull_rcsum(skb_chk, offset);
70 ret = skb_chkf(skb_chk);
71 - __skb_push(skb_chk, offset);
72 + skb_push_rcsum(skb_chk, offset);
73
74 if (ret)
75 goto err;