Re: [2/2] [NET] Add skb_header_cloned and use it in e1000/tg3
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2005-02-15 20:24:53
Attachments
- tso-mangle-2 [text/plain] 2818 bytes · preview
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2005-02-15 20:24:53
On Tue, Feb 15, 2005 at 10:33:12AM -0800, David S. Miller wrote:
The tg3 version creates an SKB leak. If pskb_expand_head() fails, we just unlock and return NETDEV_TX_OK. The upper layer assumes the driver took ownership of the SKB in such a case. I would recommend just kfree_skb()'ing the thing when this happens.
Indeed. Here is the corrected version. This patch adds skb_header_cloned which tells us whether we need to copy the data before we can modify the header part of the skb. Again, what constitutes the header is left up to the users of the skb to define. This patch then uses this function in e1000/tg3 to copy the data before the TCP/IP header is modified. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} [off-list ref] Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt