From: Pravin B Shelar Date: Thu, 15 Aug 2013 03:53:32 +0000 (-0700) Subject: datapath: compat: remove __net_init and __net_exit annotations. X-Git-Tag: sliver-openvswitch-2.0.90-1~24^2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a0014912b714f41d34eb6a11ae838aec981491ab;hp=73371c09f9f5a1a8565b2b9bd3f4c49197fc595c;p=sliver-openvswitch.git datapath: compat: remove __net_init and __net_exit annotations. net_namespace-device can get registered after module init, e.g. vxlan registers name-space-device on port add. On kernel without namespace support __net_init is defined as __init which cause panic on vxlan port add. Following patch fixes it. BUG: unable to handle kernel paging request at ffffffffa02b6293 IP: [] 0xffffffffa02b6293 PGD 1a87067 PUD 1a8b063 PMD 8371de067 PTE 0 Oops: 0010 [#1] SMP Process ovs-vswitchd (pid: 10330, threadinfo ffff8808367fe000, task f880839e16aa0) Stack: Call Trace: [] ? register_pernet_gen_device+0x74/0xd0 [] ? vxlan_rcv+0x0/0x60 [openvswitch] [] vxlan_handler_add+0x3cb/0x480 [openvswitch] [] vxlan_tnl_create+0xc4/0xf0 [openvswitch] [] ovs_vport_add+0x53/0xb0 [openvswitch] [] new_vport+0x16/0x60 [openvswitch] [] ovs_vport_cmd_new+0x109/0x210 [openvswitch] [] genl_rcv_msg+0x1d0/0x210 [] netlink_rcv_skb+0xa9/0xd0 [] genl_rcv+0x25/0x40 [] netlink_unicast+0x283/0x2d0 [] netlink_sendmsg+0x1fe/0x2e0 [] sock_sendmsg+0x123/0x150 [] __sys_sendmsg+0x406/0x420 [] sys_sendmsg+0x49/0x90 [] system_call_fastpath+0x16/0x1b Code: Bad RIP value. RIP [] 0xffffffffa02b6293 Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross Bug #19178 --- diff --git a/datapath/linux/compat/include/net/net_namespace.h b/datapath/linux/compat/include/net/net_namespace.h index 85dee1a53..440c6016a 100644 --- a/datapath/linux/compat/include/net/net_namespace.h +++ b/datapath/linux/compat/include/net/net_namespace.h @@ -82,23 +82,23 @@ extern void rpl_unregister_pernet_gen_device(struct rpl_pernet_operations *ops); #else /* for 2.6.32* */ -int __net_init compat_init_net(struct net *net, struct rpl_pernet_operations *pnet); -void __net_exit compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet); +int compat_init_net(struct net *net, struct rpl_pernet_operations *pnet); +void compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet); #define DEFINE_COMPAT_PNET_REG_FUNC(TYPE) \ \ static struct rpl_pernet_operations *pnet_gen_##TYPE; \ -static int __net_init compat_init_net_gen_##TYPE(struct net *net) \ +static int compat_init_net_gen_##TYPE(struct net *net) \ { \ return compat_init_net(net, pnet_gen_##TYPE); \ } \ \ -static void __net_exit compat_exit_net_gen_##TYPE(struct net *net) \ +static void compat_exit_net_gen_##TYPE(struct net *net) \ { \ compat_exit_net(net, pnet_gen_##TYPE); \ } \ \ -static int __net_init rpl_register_pernet_gen_##TYPE(struct rpl_pernet_operations *rpl_pnet) \ +static int rpl_register_pernet_gen_##TYPE(struct rpl_pernet_operations *rpl_pnet) \ { \ pnet_gen_##TYPE = rpl_pnet; \ rpl_pnet->ops.init = compat_init_net_gen_##TYPE; \ @@ -106,7 +106,7 @@ static int __net_init rpl_register_pernet_gen_##TYPE(struct rpl_pernet_operation return register_pernet_gen_##TYPE(pnet_gen_##TYPE->id, &rpl_pnet->ops); \ } \ \ -static void __net_exit rpl_unregister_pernet_gen_##TYPE(struct rpl_pernet_operations *rpl_pnet) \ +static void rpl_unregister_pernet_gen_##TYPE(struct rpl_pernet_operations *rpl_pnet) \ { \ unregister_pernet_gen_##TYPE(*pnet_gen_##TYPE->id, &rpl_pnet->ops); \ } diff --git a/datapath/linux/compat/net_namespace.c b/datapath/linux/compat/net_namespace.c index 82404af6e..843e6c152 100644 --- a/datapath/linux/compat/net_namespace.c +++ b/datapath/linux/compat/net_namespace.c @@ -8,7 +8,7 @@ static int net_assign_generic(struct net *net, int id, void *data); #endif -int __net_init compat_init_net(struct net *net, struct rpl_pernet_operations *pnet) +int compat_init_net(struct net *net, struct rpl_pernet_operations *pnet) { int err; void *ovs_net = kzalloc(pnet->size, GFP_KERNEL); @@ -32,7 +32,7 @@ err: return err; } -void __net_exit compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet) +void compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet) { void *ovs_net = net_generic(net, *pnet->id); diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c index 6e6b94500..f3df4e3f4 100644 --- a/datapath/linux/compat/vxlan.c +++ b/datapath/linux/compat/vxlan.c @@ -429,7 +429,7 @@ void vxlan_handler_put(struct vxlan_handler *vh) queue_work(&vh->del_work); } -static __net_init int vxlan_init_net(struct net *net) +static int vxlan_init_net(struct net *net) { struct vxlan_net *vn = net_generic(net, vxlan_net_id); unsigned int h;