aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-04-18 12:11:23 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-27 12:51:21 -0400
commit28b78eb401b7e60c0984eacf3837cf09a2307253 (patch)
treee1a516762eb8dbf1c24cd9d98efa95ce59544b01 /net/ax25
parentd76556549e7a97c25269644afd0b1b18a6c42214 (diff)
net ax25: Reorder ax25_exit to remove races.
[ Upstream commit 3adadc08cc1e2cbcc15a640d639297ef5fcb17f5 ] 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> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/ax25')
-rw-r--r--net/ax25/af_ax25.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index e7c69f4619e..b04a6ef4da9 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -2006,16 +2006,17 @@ static void __exit ax25_exit(void)
2006 proc_net_remove(&init_net, "ax25_route"); 2006 proc_net_remove(&init_net, "ax25_route");
2007 proc_net_remove(&init_net, "ax25"); 2007 proc_net_remove(&init_net, "ax25");
2008 proc_net_remove(&init_net, "ax25_calls"); 2008 proc_net_remove(&init_net, "ax25_calls");
2009 ax25_rt_free();
2010 ax25_uid_free();
2011 ax25_dev_free();
2012 2009
2013 ax25_unregister_sysctl();
2014 unregister_netdevice_notifier(&ax25_dev_notifier); 2010 unregister_netdevice_notifier(&ax25_dev_notifier);
2011 ax25_unregister_sysctl();
2015 2012
2016 dev_remove_pack(&ax25_packet_type); 2013 dev_remove_pack(&ax25_packet_type);
2017 2014
2018 sock_unregister(PF_AX25); 2015 sock_unregister(PF_AX25);
2019 proto_unregister(&ax25_proto); 2016 proto_unregister(&ax25_proto);
2017
2018 ax25_rt_free();
2019 ax25_uid_free();
2020 ax25_dev_free();
2020} 2021}
2021module_exit(ax25_exit); 2022module_exit(ax25_exit);