* gso: Stop fraglists from escaping
@ 2009-06-04 1:01 Herbert Xu
2009-06-04 4:21 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Herbert Xu @ 2009-06-04 1:01 UTC (permalink / raw)
To: David S. Miller, netdev
Hi:
gso: Stop fraglists from escaping
As it stands skb fraglists can get past the check in dev_queue_xmit
if the skb is marked as GSO. In particular, if the packet doesn't
have the proper checksums for GSO, but can otherwise be handled by
the underlying device, we will not perform the fraglist check on it
at all.
If the underlying device cannot handle fraglists, then this will
break.
The fix is as simple as moving the fraglist check from the device
check into skb_gso_ok.
This has caused crashes with Xen when used together with GRO which
can generate GSO packets with fraglists.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5a96a1a..a28daad 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1856,15 +1856,14 @@ static inline int net_gso_ok(int features, int gso_type)
static inline int skb_gso_ok(struct sk_buff *skb, int features)
{
- return net_gso_ok(features, skb_shinfo(skb)->gso_type);
+ return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
+ (!skb_shinfo(skb)->frag_list || (features & NETIF_F_FRAGLIST));
}
static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
{
return skb_is_gso(skb) &&
(!skb_gso_ok(skb, dev->features) ||
- (skb_shinfo(skb)->frag_list &&
- !(dev->features & NETIF_F_FRAGLIST)) ||
unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
}
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: gso: Stop fraglists from escaping
2009-06-04 1:01 gso: Stop fraglists from escaping Herbert Xu
@ 2009-06-04 4:21 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-06-04 4:21 UTC (permalink / raw)
To: herbert; +Cc: netdev
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Thu, 4 Jun 2009 11:01:21 +1000
> gso: Stop fraglists from escaping
>
> As it stands skb fraglists can get past the check in dev_queue_xmit
> if the skb is marked as GSO. In particular, if the packet doesn't
> have the proper checksums for GSO, but can otherwise be handled by
> the underlying device, we will not perform the fraglist check on it
> at all.
>
> If the underlying device cannot handle fraglists, then this will
> break.
>
> The fix is as simple as moving the fraglist check from the device
> check into skb_gso_ok.
>
> This has caused crashes with Xen when used together with GRO which
> can generate GSO packets with fraglists.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Applied to net-next-2.6, thanks Herbert.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-04 4:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-04 1:01 gso: Stop fraglists from escaping Herbert Xu
2009-06-04 4:21 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).