Skip to content

Commit

Permalink
IP_GRE: Fix kernel panic in IP_GRE with GRE csum.
Browse files Browse the repository at this point in the history
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 6b78f16 (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>
  • Loading branch information
Pravin B Shelar authored and David S. Miller committed Jan 28, 2013
1 parent 9839ff0 commit 5465740
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,12 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
ptr--;
}
if (tunnel->parms.o_flags&GRE_CSUM) {
int offset = skb_transport_offset(skb);

*ptr = 0;
*(__sum16 *)ptr = ip_compute_csum((void *)(iph+1), skb->len - sizeof(struct iphdr));
*(__sum16 *)ptr = csum_fold(skb_checksum(skb, offset,
skb->len - offset,
0));
}
}

Expand Down

0 comments on commit 5465740

Please sign in to comment.