Skip to contentSkip to conversation

netfilter: ebtables: make broute table work again

PATCH In review Florian Westphal 3 participants 3 messages Jan 10, 2011

Subsystems (3)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH v2 1/1 netfilter: ebtables: make broute table work again

broute table init hook sets up the "br_should_route_hook" pointer, which then gets called from br_input.

commit a386f99025f13b32502fe5dedf223c20d7283826 (bridge: add proper RCU annotation to should_route_hook) introduced a typedef, and then changed this to:

br_should_route_hook_t *rhook;
[..]
rhook = rcu_dereference(br_should_route_hook);
if (*rhook(skb))

problem is that "br_should_route_hook" contains the address of the function, so calling *rhook() results in kernel panic.

---
 include/linux/if_bridge.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/if_bridge.h +1 -1
index f7e73c3..dd3f201 100644
@@ -103,7 +103,7 @@ struct __fdb_entry {
 
 extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
 
-typedef int (*br_should_route_hook_t)(struct sk_buff *skb);
+typedef int br_should_route_hook_t(struct sk_buff *skb);
 extern br_should_route_hook_t __rcu *br_should_route_hook;
 
 #endif
Signature · 1 line
1.7.2.2
Acked-by on v2 1/1
#1 lore raw
Quoted 26 lines · Florian Westphal

broute table init hook sets up the "br_should_route_hook" pointer, which then gets called from br_input.

commit a386f99025f13b32502fe5dedf223c20d7283826 (bridge: add proper RCU annotation to should_route_hook) introduced a typedef, and then changed this to:

br_should_route_hook_t *rhook;
[..]
rhook = rcu_dereference(br_should_route_hook);
if (*rhook(skb))

problem is that "br_should_route_hook" contains the address of the function, so calling *rhook() results in kernel panic.

---
 include/linux/if_bridge.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/if_bridge.h +0 -0
index f7e73c3..dd3f201 100644

include/linux/if_bridge.h struct __fdb_entry { · line 109

Quoted 8 lines
include/linux/if_bridge.h +1 -1
@@ -103,7 +103,7 @@ struct __fdb_entry {
 
 extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
 
-typedef int (*br_should_route_hook_t)(struct sk_buff *skb);
+typedef int br_should_route_hook_t(struct sk_buff *skb);
 extern br_should_route_hook_t __rcu *br_should_route_hook;
 
 #endif

Thanks !

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 30 lines · Eric Dumazet
Quoted 29 lines · Florian Westphal

broute table init hook sets up the "br_should_route_hook" pointer, which then gets called from br_input.

commit a386f99025f13b32502fe5dedf223c20d7283826 (bridge: add proper RCU annotation to should_route_hook) introduced a typedef, and then changed this to:

br_should_route_hook_t *rhook;
[..]
rhook = rcu_dereference(br_should_route_hook);
if (*rhook(skb))

problem is that "br_should_route_hook" contains the address of the function, so calling *rhook() results in kernel panic.

---
 include/linux/if_bridge.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/if_bridge.h +0 -0
index f7e73c3..dd3f201 100644
@@ -103,7 +103,7 @@ struct __fdb_entry {
 
 extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
 
Quoted 7 lines

include/linux/if_bridge.h struct __fdb_entry { · line 109

Quoted 5 lines
include/linux/if_bridge.h +1 -1
-typedef int (*br_should_route_hook_t)(struct sk_buff *skb);
+typedef int br_should_route_hook_t(struct sk_buff *skb);
 extern br_should_route_hook_t __rcu *br_should_route_hook;
 
 #endif

Applied, thanks guys!
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html