From patchwork Tue Jan 22 22:56:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pravin B Shelar X-Patchwork-Id: 214688 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 9BDE72C0089 for ; Wed, 23 Jan 2013 09:55:52 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753850Ab3AVWzt (ORCPT ); Tue, 22 Jan 2013 17:55:49 -0500 Received: from na3sys009aog114.obsmtp.com ([74.125.149.211]:60516 "HELO na3sys009aog114.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751765Ab3AVWzs (ORCPT ); Tue, 22 Jan 2013 17:55:48 -0500 Received: from mail-ve0-f198.google.com ([209.85.128.198]) (using TLSv1) by na3sys009aob114.postini.com ([74.125.148.12]) with SMTP ID DSNKUP8Y88sHIFJuoQWn3rxsKVvVhPSX/dmn@postini.com; Tue, 22 Jan 2013 14:55:48 PST Received: by mail-ve0-f198.google.com with SMTP id ox1so1134385veb.9 for ; Tue, 22 Jan 2013 14:55:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=lk6gi0HFQq+P7gcTj3gM3KA00dyaMYwG1ZRJqjX/0kQ=; b=Sm6qLGEYxeC8qWGmm84ligYsxT3DavNtyaN2BFHtahMp1mDSEh3Lhrf/mA7gHC4KrJ ky7+MfmO5RoHiFhJ9zUyG96gXCzJoda8BEk2QxC2dfARlJ1QNKcFqtHpxyOedtPJVWQ2 6J82RMzfZIeXq3BNkFQcOCNrbDf4OXbTH0aV032kA4n2DJ/5xggbG8/lnadteA4qURS4 c1QI3RaJCkChVCNVWVlngm6bw/hhHOc8xcC9m6Ix3LOOyfA67omyVBnRIS6TsNzPJc1j G+PhIyCTBGnsR6uuAu2xYezrDw4s42co/w7pkgZxIim6IJl2sz/Q+toFExlLcd/ySlPc QQrg== X-Received: by 10.236.161.6 with SMTP id v6mr26596086yhk.121.1358895347783; Tue, 22 Jan 2013 14:55:47 -0800 (PST) X-Received: by 10.236.161.6 with SMTP id v6mr26596074yhk.121.1358895347665; Tue, 22 Jan 2013 14:55:47 -0800 (PST) Received: from localhost ([64.125.181.92]) by mx.google.com with ESMTPS id d30sm18169805yhc.4.2013.01.22.14.55.46 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Tue, 22 Jan 2013 14:55:47 -0800 (PST) From: Pravin B Shelar To: netdev@vger.kernel.org Cc: jesse@nicira.com, Pravin B Shelar Subject: [PATCH v2] IP_GRE: Fix kernel panic in IP_GRE with GRE csum. Date: Tue, 22 Jan 2013 14:56:38 -0800 Message-Id: <1358895398-2088-1-git-send-email-pshelar@nicira.com> X-Mailer: git-send-email 1.7.12.315.g682ce8b X-Gm-Message-State: ALoCoQlP53ZTQFhkNCBscQTSIER3acSHN7jB9f3+F7TyZIKB2r3W30BLnYQLAzMrmMcbRp5PjLzLZySRbaA9syFCM6nHcOpT/zxz651d+TFFo7MfzLqn9mpOLnZ9NGpUH6fkEyRVPTNgSL5FewKQFBgLNMfrDexX09K0nmaJ/90+9/gOpd2PIvo= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Fixed code indentation according to comments from David Miller. --8<--------------------------cut here-------------------------->8-- Due to 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. Signed-off-by: Pravin B Shelar --- net/ipv4/ip_gre.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 303012a..8179e066 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -964,7 +964,10 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev } if (tunnel->parms.o_flags&GRE_CSUM) { *ptr = 0; - *(__sum16 *)ptr = ip_compute_csum((void *)(iph+1), skb->len - sizeof(struct iphdr)); + *(__sum16 *)ptr = csum_fold(skb_checksum(skb, + skb_transport_offset(skb), + skb->len - skb_transport_offset(skb), + 0)); } }