diff mbox

VLAN over GRE segfault

Message ID 1300444047.2888.18.camel@edumazet-laptop
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet March 18, 2011, 10:27 a.m. UTC
Le vendredi 18 mars 2011 à 08:34 +0100, Diddi Oscarsson a écrit :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello!
> 
> I was trying to get ethernet over GRE to work when I found an obvious
> way NOT to do it.
> Basically I created a VLAN interface from the GRE interface (even
> though I had my fair doubts it would work) which gave me a nice segfault.
> The problem with this is that after the segfault, new network
> connections cannot be made (ping, ssh, http, whatever) and a reboot of
> the computer is necessary.
> I think an error message needs to be added when trying an operation
> like this.
> 
> My system:
> Linux colalapp 2.6.37-2-amd64 #1 SMP Sun Feb 27 10:12:22 UTC 2011
> x86_64 GNU/Linux
> ip utility, iproute2-ss110107
> Debian unstable
> 
> Steps to reproduce:
> ip tunnel add gre0 mode gre
> ip link add link gre0 name vlan1 type vlan id 1
> ip link set vlan1 address 00:15:14:13:12:11
> ip link set gre0 up
> ip link set vlan1 up
> <CRASH>
> Attached in the mail is an output from dmesg right after the segfault.
> 
> Regarding ethernet over gre, I've just found out about gretap which
> I'm testing right now.

Hi Diddi

It might be a 2.6.28 regression, after commit c95b819ad7
(gre: Use needed_headroom)

Thanks

[PATCH] vlan: should take into account needed_headroom

Commit c95b819ad7 (gre: Use needed_headroom)
made gre use needed_headroom instead of hard_header_len

This uncover a bug in vlan code.

We should make sure vlan devices take into account their
real_dev->needed_headroom or we risk a crash in ipgre_header(), because
we dont have enough room to push IP header in skb.

Reported-by: Diddi Oscarsson <diddi@diddi.se>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
---
 net/8021q/vlan_dev.c |    1 +
 1 files changed, 1 insertion(+)



--
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

Comments

Herbert Xu March 18, 2011, 7:28 p.m. UTC | #1
On Fri, Mar 18, 2011 at 11:27:27AM +0100, Eric Dumazet wrote:
>
> This uncover a bug in vlan code.
> 
> We should make sure vlan devices take into account their
> real_dev->needed_headroom or we risk a crash in ipgre_header(), because
> we dont have enough room to push IP header in skb.
> 
> Reported-by: Diddi Oscarsson <diddi@diddi.se>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Patrick McHardy <kaber@trash.net>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Thanks,
David Miller March 18, 2011, 10:16 p.m. UTC | #2
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Fri, 18 Mar 2011 14:28:59 -0500

> On Fri, Mar 18, 2011 at 11:27:27AM +0100, Eric Dumazet wrote:
>>
>> This uncover a bug in vlan code.
>> 
>> We should make sure vlan devices take into account their
>> real_dev->needed_headroom or we risk a crash in ipgre_header(), because
>> we dont have enough room to push IP header in skb.
>> 
>> Reported-by: Diddi Oscarsson <diddi@diddi.se>
>> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
>> Cc: Patrick McHardy <kaber@trash.net>
>> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> 
> Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied.
--
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
diff mbox

Patch

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index ae610f0..e34ea9e 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -720,6 +720,7 @@  static int vlan_dev_init(struct net_device *dev)
 	dev->fcoe_ddp_xid = real_dev->fcoe_ddp_xid;
 #endif
 
+	dev->needed_headroom = real_dev->needed_headroom;
 	if (real_dev->features & NETIF_F_HW_VLAN_TX) {
 		dev->header_ops      = real_dev->header_ops;
 		dev->hard_header_len = real_dev->hard_header_len;