1 From: Greg Kroah-Hartman <gregkh@suse.de>
2 Subject: ABI: add back skb_truesize_bug() and skb_truesize_check()
4 These functions were removed in 2.6.27.20 as they are broken and don't
7 But, some foolish external modules might actually be using them, so be
8 safe and put them back in, but do not put back in the internal network
9 checks that called them, as that's not needed.
11 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 include/linux/skbuff.h | 9 +++++++++
15 net/core/skbuff.c | 8 ++++++++
16 2 files changed, 17 insertions(+)
18 --- a/include/linux/skbuff.h
19 +++ b/include/linux/skbuff.h
20 @@ -395,6 +395,15 @@ extern void skb_over_panic(struct
22 extern void skb_under_panic(struct sk_buff *skb, int len,
24 +extern void skb_truesize_bug(struct sk_buff *skb);
26 +static inline void skb_truesize_check(struct sk_buff *skb)
28 + int len = sizeof(struct sk_buff) + skb->len;
30 + if (unlikely((int)skb->truesize < len))
31 + skb_truesize_bug(skb);
34 extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
35 int getfrag(void *from, char *to, int offset,
36 --- a/net/core/skbuff.c
37 +++ b/net/core/skbuff.c
38 @@ -143,6 +143,14 @@ void skb_under_panic(struct sk_buff *skb
42 +void skb_truesize_bug(struct sk_buff *skb)
44 + printk(KERN_ERR "SKB BUG: Invalid truesize (%u) "
45 + "len=%u, sizeof(sk_buff)=%Zd\n",
46 + skb->truesize, skb->len, sizeof(struct sk_buff));
48 +EXPORT_SYMBOL(skb_truesize_bug);
50 /* Allocate a new skbuff. We do this ourselves so we can fill in a few
51 * 'private' fields and also do memory statistics to find all the