From: Oleg Nesterov Date: Tue, 13 Mar 2012 18:07:18 +0000 (+0100) Subject: staging: usbip: fix the usage of kthread_stop() X-Git-Tag: v3.5-rc1~145^2~229^2~300 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba46ce30f13a13bb24d05e21df2571ad724f1a1e;p=pandora-kernel.git staging: usbip: fix the usage of kthread_stop() stub_shutdown_connection() and vhci_shutdown_connection() use task_is_dead() before kthread_stop(). This buys nothing and wrong. kthread_stop() is fine even if this thread is dead. However, if it is dead nothing protects this task_struct, we shouldn't touch this memory. Change the code to do the necessary get_task_struct/put_task_struct. This patch assumes that - xxx_shutdown_connection() is always called, so we can't leak the task_struct. - kthread_stop_put() can't be called twice on the same task. Signed-off-by: Oleg Nesterov Cc: Tobias Klauser Cc: Matt Mooney , Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed