From 58e6ae23ad99a6a24fd0058dda474fc4981fcb30 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Thu, 27 Jun 2013 10:05:58 +0200 Subject: [PATCH] light: workaround nasty race on kthread_stop() --- kernel/sy_old/mars_light.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/sy_old/mars_light.c b/kernel/sy_old/mars_light.c index ecf7e9d7..db04cdd5 100644 --- a/kernel/sy_old/mars_light.c +++ b/kernel/sy_old/mars_light.c @@ -4415,6 +4415,14 @@ static void __exit exit_light(void) MARS_DBG("====================== stopped everything.\n"); exit_say(); printk(KERN_INFO "stopped MARS\n"); + /* Workaround for nasty race: some kernel threads have not yet + * really finished even _after_ kthread_stop() and may execute + * some code which will disappear right after return from this + * function. + * A correct solution would probably need the help of the kernel + * scheduler. + */ + brick_msleep(1000); } static int __init init_light(void)