Patchwork [v2] IP_GRE: Fix kernel panic in IP_GRE with GRE csum.

login
register
mail settings
Submitter Pravin B Shelar
Date Jan. 22, 2013, 10:56 p.m.
Message ID <1358895398-2088-1-git-send-email-pshelar@nicira.com>
Download mbox | patch
Permalink /patch/214688/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Pravin B Shelar - Jan. 22, 2013, 10:56 p.m.
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 <pshelar@nicira.com>
---
 net/ipv4/ip_gre.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
David Miller - Jan. 23, 2013, 1:55 a.m.
From: Pravin B Shelar <pshelar@nicira.com>
Date: Tue, 22 Jan 2013 14:56:38 -0800

> Fixed code indentation according to comments from David Miller.
> 
> --8<--------------------------cut here-------------------------->8--

This doesn't do what you think it does.  No automated tool is going
to edit the commit message the way you think this will.

You should instead put your "what is different in this revision"
comments right after the "---" below.

> 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 <pshelar@nicira.com>
> ---
 ^^^

Right after that line.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Pfaff - Jan. 23, 2013, 5:08 a.m.
David Miller <davem@davemloft.net> writes:

> From: Pravin B Shelar <pshelar@nicira.com>
> Date: Tue, 22 Jan 2013 14:56:38 -0800
>
>> Fixed code indentation according to comments from David Miller.
>> 
>> --8<--------------------------cut here-------------------------->8--
>
> This doesn't do what you think it does.  No automated tool is going
> to edit the commit message the way you think this will.

"git am" does if you run with --scissors, see git-am(1):

       -c, --scissors
           Remove everything in body before a scissors line (see git-
           mailinfo(1)).

and git-mailinfo(1);

       --scissors
           Remove everything in body before a scissors line. A line that
           mainly consists of scissors (either ">8" or "8<") and perforation
           (dash "-") marks is called a scissors line, and is used to request
           the reader to cut the message at that line. If such a line appears
           in the body of the message before the patch, everything before it
           (including the scissors line itself) is ignored when this option is
           used.

           This is useful if you want to begin your message in a discussion
           thread with comments and suggestions on the message you are
           responding to, and to conclude it with a patch submission,
           separating the discussion and the beginning of the proposed commit
           log message with a scissors line.

           This can enabled by default with the configuration option
           mailinfo.scissors.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Jan. 23, 2013, 5:20 a.m.
From: Ben Pfaff <blp@cs.stanford.edu>
Date: Tue, 22 Jan 2013 21:08:33 -0800

> David Miller <davem@davemloft.net> writes:
> 
>> From: Pravin B Shelar <pshelar@nicira.com>
>> Date: Tue, 22 Jan 2013 14:56:38 -0800
>>
>>> Fixed code indentation according to comments from David Miller.
>>> 
>>> --8<--------------------------cut here-------------------------->8--
>>
>> This doesn't do what you think it does.  No automated tool is going
>> to edit the commit message the way you think this will.
> 
> "git am" does if you run with --scissors, see git-am(1):
> 
>        -c, --scissors
>            Remove everything in body before a scissors line (see git-
>            mailinfo(1)).

I'd rather not have to do that for submissions, thanks.
Furthermore patchwork doesn't parse this convention either.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
YOSHIFUJI Hideaki / 吉藤英明 - Jan. 23, 2013, 2 p.m.
Pravin B Shelar wrote:
> 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 <pshelar@nicira.com>
> ---
>  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));

IMHO, arguments for skb_checksum() should be aligned:

			*(__sum16 *)ptr = csum_fold(skb_checksum(skb,
								 skb_transport_offset(skb),
								 skb->len - skb_transport_offset(skb),
								 0));

--yoshfuji
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

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));
 		}
 	}