Re: [PATCH] pppoe: fix race at init time

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Cyrill Gorcunov
Date: Wednesday, July 29, 2009 - 7:46 am

[Igor M Podlesny - Wed, Jul 29, 2009 at 11:55:45AM +0800]
... 
| 	At last the 3rd patch was also unable to fix the bug.
|
...

Hi Igor,

could you give the following patch a chance please.
Not sure if it help but anyway.

	-- Cyrill
---
net,pppoe: fixup module init/exit subsequent calls

pernet data should allocated first and freed last
on module init/exit routines otherwise it's possible
to have unserialized calls to packet handling routines.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 drivers/net/pppoe.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

Index: linux-2.6.git/drivers/net/pppoe.c
=====================================================================
--- linux-2.6.git.orig/drivers/net/pppoe.c
+++ linux-2.6.git/drivers/net/pppoe.c
@@ -1184,17 +1184,17 @@ static int __init pppoe_init(void)
 {
 	int err;
 
-	err = proto_register(&pppoe_sk_proto, 0);
+	err = register_pernet_gen_device(&pppoe_net_id, &pppoe_net_ops);
 	if (err)
 		goto out;
 
-	err = register_pppox_proto(PX_PROTO_OE, &pppoe_proto);
+	err = proto_register(&pppoe_sk_proto, 0);
 	if (err)
-		goto out_unregister_pppoe_proto;
+		goto out_unregister_net_ops;
 
-	err = register_pernet_gen_device(&pppoe_net_id, &pppoe_net_ops);
+	err = register_pppox_proto(PX_PROTO_OE, &pppoe_proto);
 	if (err)
-		goto out_unregister_pppox_proto;
+		goto out_unregister_pppoe_proto;
 
 	dev_add_pack(&pppoes_ptype);
 	dev_add_pack(&pppoed_ptype);
@@ -1202,22 +1202,22 @@ static int __init pppoe_init(void)
 
 	return 0;
 
-out_unregister_pppox_proto:
-	unregister_pppox_proto(PX_PROTO_OE);
 out_unregister_pppoe_proto:
 	proto_unregister(&pppoe_sk_proto);
+out_unregister_net_ops:
+	unregister_pernet_gen_device(pppoe_net_id, &pppoe_net_ops);
 out:
 	return err;
 }
 
 static void __exit pppoe_exit(void)
 {
-	unregister_pppox_proto(PX_PROTO_OE);
-	dev_remove_pack(&pppoes_ptype);
-	dev_remove_pack(&pppoed_ptype);
 	unregister_netdevice_notifier(&pppoe_notifier);
-	unregister_pernet_gen_device(pppoe_net_id, &pppoe_net_ops);
+	dev_remove_pack(&pppoed_ptype);
+	dev_remove_pack(&pppoes_ptype);
+	unregister_pppox_proto(PX_PROTO_OE);
 	proto_unregister(&pppoe_sk_proto);
+	unregister_pernet_gen_device(pppoe_net_id, &pppoe_net_ops);
 }
 
 module_init(pppoe_init);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] net: net_assign_generic() fix , Eric Dumazet, (Tue Jul 28, 5:36 am)
Re: [PATCH] net: net_assign_generic() fix, Pavel Emelyanov, (Tue Jul 28, 6:03 am)
Re: [PATCH] net: net_assign_generic() fix, Eric Dumazet, (Tue Jul 28, 6:16 am)
Re: [PATCH] net: net_assign_generic() fix, Eric Dumazet, (Tue Jul 28, 6:22 am)
[PATCH] pppoe: fix race at init time, Eric Dumazet, (Tue Jul 28, 10:46 am)
Re: [PATCH] pppoe: fix race at init time, Cyrill Gorcunov, (Tue Jul 28, 11:48 am)
Re: [PATCH] pppoe: fix race at init time, Igor M Podlesny, (Tue Jul 28, 8:55 pm)
Re: [PATCH] pppoe: fix race at init time, Eric Dumazet, (Tue Jul 28, 9:33 pm)
[PATCH] pppoe: fix /proc/net/pppoe, Eric Dumazet, (Wed Jul 29, 2:43 am)
Re: [PATCH] pppoe: fix race at init time, Cyrill Gorcunov, (Wed Jul 29, 7:46 am)
Re: [PATCH] pppoe: fix /proc/net/pppoe, David Miller, (Thu Jul 30, 2:19 pm)
Re: [PATCH] net: net_assign_generic() fix, David Miller, (Sun Aug 2, 12:27 pm)
Re: [PATCH] pppoe: fix race at init time, David Miller, (Wed Aug 12, 4:40 pm)
Re: [PATCH] pppoe: fix race at init time, Cyrill Gorcunov, (Fri Aug 14, 9:42 am)