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 b3c2f7a..7c6c1ca 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 543ba9b..a6fc906 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