]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.kabi/abi-add-back-skb_truesize_bug-and-skb_truesize_check.patch
Revert "Move xen patchset to new version's subdir."
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.kabi / abi-add-back-skb_truesize_bug-and-skb_truesize_check.patch
CommitLineData
00e5a55c
BS
1From: Greg Kroah-Hartman <gregkh@suse.de>
2Subject: ABI: add back skb_truesize_bug() and skb_truesize_check()
3
4These functions were removed in 2.6.27.20 as they are broken and don't
5really work properly.
6
7But, some foolish external modules might actually be using them, so be
8safe and put them back in, but do not put back in the internal network
9checks that called them, as that's not needed.
10
11Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12
13---
14 include/linux/skbuff.h | 9 +++++++++
15 net/core/skbuff.c | 8 ++++++++
16 2 files changed, 17 insertions(+)
17
18--- a/include/linux/skbuff.h
19+++ b/include/linux/skbuff.h
20@@ -395,6 +395,15 @@ extern void skb_over_panic(struct
21 void *here);
22 extern void skb_under_panic(struct sk_buff *skb, int len,
23 void *here);
24+extern void skb_truesize_bug(struct sk_buff *skb);
25+
26+static inline void skb_truesize_check(struct sk_buff *skb)
27+{
28+ int len = sizeof(struct sk_buff) + skb->len;
29+
30+ if (unlikely((int)skb->truesize < len))
31+ skb_truesize_bug(skb);
32+}
33
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
39 BUG();
40 }
41
42+void skb_truesize_bug(struct sk_buff *skb)
43+{
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));
47+}
48+EXPORT_SYMBOL(skb_truesize_bug);
49+
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
52 * [BEEP] leaks.