From: James Chapman <jchapman@katalix.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: L2TP: skb truesize bug in recent kernels
Date: Wed, 14 May 2008 12:15:02 +0100 [thread overview]
Message-ID: <482AC9B6.4080700@katalix.com> (raw)
In-Reply-To: <20080514.031256.180455080.davem@davemloft.net>
David Miller wrote:
> From: James Chapman <jchapman@katalix.com>
> Date: Wed, 14 May 2008 11:07:16 +0100
>
>> The pppol2tp driver uses skb_cow_head() to make headroom for IP, UDP,
>> L2TP and PPP headers. As GRE is being used, it is more likely that there
>> will be insufficient headroom. Does the pppol2tp driver need to adjust
>> truesize if pskb_expand_head() is called?
>>
>> I tried the following hack which stopped the skb truesize bug but caused
>> a kernel assert when the socket was closed:
>>
>> KERN: assertion (!atomic_read(&sk->sk_wmem_alloc)) failed at
>> net/ipv4/af_inet.c (155)
>
> You can't adjust the truesize when there is a socket associated
> with the SKB.
>
> We just had a weeklong thread on this list about these issues
> wrt. the wireless stack :-)
Yeah, I saw that thread but thought it was a different problem. :)
> skb->truesize records how much memory was charged to the assosicated
> socket, so when the socket is freed, the destructor goes
>
> atomic_dec(&sk->sk_{r,w}mem_alloc, skb->truesize);
>
> so if you increase truesize, the counter will be decremented
> more than it was initially incremented.
>
> You cannot change the size of the packet substantially when there is a
> socket associated with it, because this makes the truesize inaccurate,
> and thus provides a vector for a user's socket to use up more memory
> than we were originally going to let it use based upon it's send and
> receive buffer limits.
I see. Thanks for the explanation. Presumably kernels 2.6.24.4 and
earlier aren't checking truesize for UDP sockets.
I'll change pppol2tp to allow some slack in its sock_wmalloc() call.
--
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development
prev parent reply other threads:[~2008-05-14 11:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-14 10:07 L2TP: skb truesize bug in recent kernels James Chapman
2008-05-14 10:12 ` David Miller
2008-05-14 11:15 ` James Chapman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=482AC9B6.4080700@katalix.com \
--to=jchapman@katalix.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox