[RFC/T] [NET] make pskb_expand_head warn when called with invalid state

Johannes Berg
2008-05-04T18:16:10Z

This makes pskb_expand_head warn when called when a socket is attached.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
Based on a different patch by davem.

Will also trigger with mac80211.

net/core/skbuff.c | 2 ++
1 file changed, 2 insertions(+)

--- everything.orig/net/core/skbuff.c 2008-05-04 01:18:49.000000000 +0200
+++ everything/net/core/skbuff.c 2008-05-04 01:23:50.000000000 +0200
@@ -689,6 +689,8 @@ int pskb_expand_head(struct sk_buff *skb
if (!data)
goto nodata;

+ WARN_ON((nhead || ntail) && skb->sk);
+
/* Copy only real data... and, alas, header. This should be
* optimized for the cases when header is void. */
#ifdef NET_SKBUFF_DATA_USES_OFFSET