]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.31/patches.kabi/abi-add-back-skb_truesize_bug-and-skb_truesize_check.patch
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.kabi / abi-add-back-skb_truesize_bug-and-skb_truesize_check.patch
diff --git a/src/patches/suse-2.6.27.31/patches.kabi/abi-add-back-skb_truesize_bug-and-skb_truesize_check.patch b/src/patches/suse-2.6.27.31/patches.kabi/abi-add-back-skb_truesize_bug-and-skb_truesize_check.patch
new file mode 100644 (file)
index 0000000..4735276
--- /dev/null
@@ -0,0 +1,52 @@
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: ABI: add back skb_truesize_bug() and skb_truesize_check()
+
+These functions were removed in 2.6.27.20 as they are broken and don't
+really work properly.
+
+But, some foolish external modules might actually be using them, so be
+safe and put them back in, but do not put back in the internal network
+checks that called them, as that's not needed.
+
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ include/linux/skbuff.h |    9 +++++++++
+ net/core/skbuff.c      |    8 ++++++++
+ 2 files changed, 17 insertions(+)
+
+--- a/include/linux/skbuff.h
++++ b/include/linux/skbuff.h
+@@ -395,6 +395,15 @@ extern void             skb_over_panic(struct 
+                                    void *here);
+ extern void         skb_under_panic(struct sk_buff *skb, int len,
+                                     void *here);
++extern void         skb_truesize_bug(struct sk_buff *skb);
++
++static inline void skb_truesize_check(struct sk_buff *skb)
++{
++      int len = sizeof(struct sk_buff) + skb->len;
++
++      if (unlikely((int)skb->truesize < len))
++              skb_truesize_bug(skb);
++}
+ extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
+                       int getfrag(void *from, char *to, int offset,
+--- a/net/core/skbuff.c
++++ b/net/core/skbuff.c
+@@ -143,6 +143,14 @@ void skb_under_panic(struct sk_buff *skb
+       BUG();
+ }
++void skb_truesize_bug(struct sk_buff *skb)
++{
++      printk(KERN_ERR "SKB BUG: Invalid truesize (%u) "
++             "len=%u, sizeof(sk_buff)=%Zd\n",
++             skb->truesize, skb->len, sizeof(struct sk_buff));
++}
++EXPORT_SYMBOL(skb_truesize_bug);
++
+ /*    Allocate a new skbuff. We do this ourselves so we can fill in a few
+  *    'private' fields and also do memory statistics to find all the
+  *    [BEEP] leaks.