* [PATCH] net ax25: Reorder ax25_exit to remove races.
@ 2012-04-19 2:11 Eric W. Biederman
2012-04-19 19:38 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric W. Biederman @ 2012-04-19 2:11 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Ralf Baechle, linux-hams
While reviewing the sysctl code in ax25 I spotted races in ax25_exit
where it is possible to receive notifications and packets after already
freeing up some of the data structures needed to process those
notifications and updates.
Call unregister_netdevice_notifier early so that the rest of the cleanup
code does not need to deal with network devices. This takes advantage
of my recent enhancement to unregister_netdevice_notifier to send
unregister notifications of all network devices that are current
registered.
Move the unregistration for packet types, socket types and protocol
types before we cleanup any of the ax25 data structures to remove the
possibilities of other races.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
net/ax25/af_ax25.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 0906c19..9d9a6a3 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -2011,16 +2011,17 @@ static void __exit ax25_exit(void)
proc_net_remove(&init_net, "ax25_route");
proc_net_remove(&init_net, "ax25");
proc_net_remove(&init_net, "ax25_calls");
- ax25_rt_free();
- ax25_uid_free();
- ax25_dev_free();
- ax25_unregister_sysctl();
unregister_netdevice_notifier(&ax25_dev_notifier);
+ ax25_unregister_sysctl();
dev_remove_pack(&ax25_packet_type);
sock_unregister(PF_AX25);
proto_unregister(&ax25_proto);
+
+ ax25_rt_free();
+ ax25_uid_free();
+ ax25_dev_free();
}
module_exit(ax25_exit);
--
1.7.2.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net ax25: Reorder ax25_exit to remove races.
2012-04-19 2:11 [PATCH] net ax25: Reorder ax25_exit to remove races Eric W. Biederman
@ 2012-04-19 19:38 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-04-19 19:38 UTC (permalink / raw)
To: ebiederm; +Cc: netdev, ralf, linux-hams
From: ebiederm@xmission.com (Eric W. Biederman)
Date: Wed, 18 Apr 2012 19:11:23 -0700
> While reviewing the sysctl code in ax25 I spotted races in ax25_exit
> where it is possible to receive notifications and packets after already
> freeing up some of the data structures needed to process those
> notifications and updates.
>
> Call unregister_netdevice_notifier early so that the rest of the cleanup
> code does not need to deal with network devices. This takes advantage
> of my recent enhancement to unregister_netdevice_notifier to send
> unregister notifications of all network devices that are current
> registered.
>
> Move the unregistration for packet types, socket types and protocol
> types before we cleanup any of the ax25 data structures to remove the
> possibilities of other races.
>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Applied, thanks a lot Eric.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-19 19:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-19 2:11 [PATCH] net ax25: Reorder ax25_exit to remove races Eric W. Biederman
2012-04-19 19:38 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).