netdev
[Top] [All Lists]

Re: [2/2] [NET] Add skb_header_cloned and use it in e1000/tg3

To: "David S. Miller" <davem@xxxxxxxxxxxxx>
Subject: Re: [2/2] [NET] Add skb_header_cloned and use it in e1000/tg3
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 16 Feb 2005 07:24:53 +1100
Cc: kuznet@xxxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20050215103312.6178385f.davem@xxxxxxxxxxxxx>
References: <20050122170533.GB11499@xxxxxxxxxxxxxxx> <20050123071027.GA20296@xxxxxxxxxxxxxxxxxxx> <20050126110043.GA29950@xxxxxxxxxxxxxxx> <20050126222522.GA21670@xxxxxxxxxxxxxxxxxxx> <20050127110946.GA20494@xxxxxxxxxxxxxxxxxxx> <20050127111201.GB20494@xxxxxxxxxxxxxxxxxxx> <20050128202542.GA23670@xxxxxxxxxxxxxxx> <20050129031740.GA6130@xxxxxxxxxxxxxxxxxxx> <20050129032210.GA7424@xxxxxxxxxxxxxxxxxxx> <20050215103312.6178385f.davem@xxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.6+20040722i
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@xxxxxxxxxxxxxxxxxxx>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Attachment: tso-mangle-2
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>