diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2007-05-09 05:34:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 15:30:52 -0400 |
commit | c214b2cc5f9be7c236f9b91acf524688ff0e3e72 (patch) | |
tree | 9edffda8f78422d01219dacf9ab2fb0104302a1d /net/ipv4/ipvs/ip_vs_ctl.c | |
parent | 1634c48f8b85dcb05101f1eb2eab9af40b5976da (diff) |
ipvs: flush defense_work before module unload
net/ipv4/ipvs/ip_vs_core.c
module_exit
ip_vs_cleanup
ip_vs_control_cleanup
cancel_rearming_delayed_work
// done
This is unsafe. The module may be unloaded and the memory may be freed
while defense_work's handler is still running/preempted.
Do flush_work(&defense_work.work) after cancel_rearming_delayed_work().
Alternatively, we could add flush_work() to cancel_rearming_delayed_work(),
but note that we can't change cancel_delayed_work() in the same manner
because it may be called from atomic context.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/ipv4/ipvs/ip_vs_ctl.c')
-rw-r--r-- | net/ipv4/ipvs/ip_vs_ctl.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index b3050a6817e7..342e836677a1 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
@@ -2387,6 +2387,7 @@ void ip_vs_control_cleanup(void) | |||
2387 | EnterFunction(2); | 2387 | EnterFunction(2); |
2388 | ip_vs_trash_cleanup(); | 2388 | ip_vs_trash_cleanup(); |
2389 | cancel_rearming_delayed_work(&defense_work); | 2389 | cancel_rearming_delayed_work(&defense_work); |
2390 | flush_work_keventd(&defense_work.work); | ||
2390 | ip_vs_kill_estimator(&ip_vs_stats); | 2391 | ip_vs_kill_estimator(&ip_vs_stats); |
2391 | unregister_sysctl_table(sysctl_header); | 2392 | unregister_sysctl_table(sysctl_header); |
2392 | proc_net_remove("ip_vs_stats"); | 2393 | proc_net_remove("ip_vs_stats"); |