Verify in fwd_port_input() that we are not passed packets that are shared.
authorBen Pfaff <blp@nicira.com>
Tue, 11 Nov 2008 22:03:31 +0000 (14:03 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 13 Nov 2008 20:44:04 +0000 (12:44 -0800)
datapath/forward.c
datapath/linux-2.4/compat-2.4/include/asm/bug.h [new file with mode: 0644]
datapath/linux-2.4/compat-2.4/include/linux/kernel.h

index b3c2f7af4f27d2168254b1f4713d5b4a554f56a8..7c6c1caed151fa01875c679b156dab16680bb8c9 100644 (file)
@@ -68,6 +68,7 @@ int run_flow_through_tables(struct sw_chain *chain, struct sk_buff *skb,
 void fwd_port_input(struct sw_chain *chain, struct sk_buff *skb,
                    struct net_bridge_port *p)
 {
+       WARN_ON_ONCE(skb_shared(skb));
        if (run_flow_through_tables(chain, skb, p))
                dp_output_control(chain->dp, skb, fwd_save_skb(skb), 
                                  chain->dp->miss_send_len,
diff --git a/datapath/linux-2.4/compat-2.4/include/asm/bug.h b/datapath/linux-2.4/compat-2.4/include/asm/bug.h
new file mode 100644 (file)
index 0000000..b475d7e
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef _ASM_GENERIC_BUG_H
+#define _ASM_GENERIC_BUG_H
+
+#include <linux/compiler.h>
+
+#define WARN_ON_ONCE(condition)        ({                              \
+       static int __warned;                                    \
+       int __ret_warn_once = !!(condition);                    \
+                                                               \
+       if (unlikely(__ret_warn_once) && !__warned) {           \
+               WARN_ON(1);                                     \
+               __warned = 1;                                   \
+       }                                                       \
+       unlikely(__ret_warn_once);                              \
+})
+
+#endif
index 543ba9b63dc83fea0f3ba4c0f28f6afb2291f794..a6fc906dc2dc6d4c071f37eea3164b824ca93e8a 100644 (file)
@@ -3,6 +3,7 @@
 
 #include_next <linux/kernel.h>
 #include <linux/config.h>
+#include <asm/bug.h>
 
 /**
  * container_of - cast a member of a structure out to the containing structure