Commit 5465740ace36f179de5bb0ccb5d46ddeb945e309

Authored by Pravin B Shelar
Committed by David S. Miller
1 parent 9839ff0dea

IP_GRE: Fix kernel panic in IP_GRE with GRE csum.

Due to IP_GRE GSO support, GRE can recieve non linear skb which
results in panic in case of GRE_CSUM.  Following patch fixes it by
using correct csum API.

Bug introduced in commit 6b78f16e4bdde3936b (gre: add GSO support)

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff

... ... @@ -963,8 +963,12 @@
963 963 ptr--;
964 964 }
965 965 if (tunnel->parms.o_flags&GRE_CSUM) {
  966 + int offset = skb_transport_offset(skb);
  967 +
966 968 *ptr = 0;
967   - *(__sum16 *)ptr = ip_compute_csum((void *)(iph+1), skb->len - sizeof(struct iphdr));
  969 + *(__sum16 *)ptr = csum_fold(skb_checksum(skb, offset,
  970 + skb->len - offset,
  971 + 0));
968 972 }
969 973 }
970 974