From ae0af9b03d7f20e318a0b9e9846a74137104d8cf Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 11 Nov 2008 14:03:31 -0800 Subject: [PATCH] Verify in fwd_port_input() that we are not passed packets that are shared. --- datapath/forward.c | 1 + datapath/linux-2.4/compat-2.4/include/asm/bug.h | 17 +++++++++++++++++ .../linux-2.4/compat-2.4/include/linux/kernel.h | 1 + 3 files changed, 19 insertions(+) create mode 100644 datapath/linux-2.4/compat-2.4/include/asm/bug.h diff --git a/datapath/forward.c b/datapath/forward.c index b3c2f7af4..7c6c1caed 100644 --- a/datapath/forward.c +++ b/datapath/forward.c @@ -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 index 000000000..b475d7e93 --- /dev/null +++ b/datapath/linux-2.4/compat-2.4/include/asm/bug.h @@ -0,0 +1,17 @@ +#ifndef _ASM_GENERIC_BUG_H +#define _ASM_GENERIC_BUG_H + +#include + +#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 diff --git a/datapath/linux-2.4/compat-2.4/include/linux/kernel.h b/datapath/linux-2.4/compat-2.4/include/linux/kernel.h index 543ba9b63..a6fc906dc 100644 --- a/datapath/linux-2.4/compat-2.4/include/linux/kernel.h +++ b/datapath/linux-2.4/compat-2.4/include/linux/kernel.h @@ -3,6 +3,7 @@ #include_next #include +#include /** * container_of - cast a member of a structure out to the containing structure -- 2.43.0