Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c214b2cc authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds
Browse files

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: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1634c48f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2387,6 +2387,7 @@ void ip_vs_control_cleanup(void)
	EnterFunction(2);
	ip_vs_trash_cleanup();
	cancel_rearming_delayed_work(&defense_work);
	flush_work_keventd(&defense_work.work);
	ip_vs_kill_estimator(&ip_vs_stats);
	unregister_sysctl_table(sysctl_header);
	proc_net_remove("ip_vs_stats");