[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1209641914.3904.0.camel@johannes.berg>
Date: Thu, 01 May 2008 13:38:33 +0200
From: Johannes Berg <johannes@...solutions.net>
To: David Miller <davem@...emloft.net>
Cc: herbert@...dor.apana.org.au, mb@...sch.de, netdev@...r.kernel.org,
linux-wireless@...r.kernel.org
Subject: Re: mac80211 truesize bugs
> That makes more sense, good catch Herbert.
>
> I guess it's the pskb_expand_head() calls done by net/mac80211/tx.c
> I suspect we'll need to orphan early in order to accomodate these
> adjustments, otherwise socket memory buffer allocations will
> be corrupted.
>
> Once that is cured, I think we can detect this better, by adding a
> carefully constructed assertion to pskb_expand_head(). Basically, the
> idea is, if "nhead" or "ntail" are non-zero, and there is a socket
> still attached to the SKB, print a warning message.
>
> Something like:
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 4fe605f..9bfca08 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -699,6 +699,12 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
> if (skb_shared(skb))
> BUG();
>
> + if (unlikely((nhead || ntail) && skb->sk)) {
> + printk(KERN_ERR "SKB BUG: Illegal pskb expand (%d:%d) "
> + "with socket attached\n",
> + nhead, ntail);
> + }
> +
> size = SKB_DATA_ALIGN(size);
Ok I think I'm starting to understand this a little better. However,
shouldn't this function update skb->truesize so if the skb is later
attached to a different socket again it has the right size?
johannes
Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)
Powered by blists - more mailing lists