From: Daniel Drake Date: Tue, 11 Jun 2013 19:40:20 +0000 (-0400) Subject: Bluetooth: btmrvl: fix thread stopping race X-Git-Tag: v3.10~13^2~34^2~2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea05fea9042620ac3b8ab9a3e5e4d2ed80c89244;p=pandora-kernel.git Bluetooth: btmrvl: fix thread stopping race There is currently a race condition in the btmrvl_remove_card() which is causing hangs on suspend for OLPC. When the race occurs, kthread_stop() never returns. The problem is that btmrvl_service_main_thread() calls kthread_should_stop() and then does a fair number of things before restarting the loop and sleeping. If the thread gets stopped after kthread_should_stop() is checked, but before the sleep happens, the thread will go to sleep and won't necessarily be woken up. Move the kthread_should_stop() check into a race-free place. Signed-off-by: Daniel Drake Signed-off-by: Gustavo Padovan Signed-off-by: John W. Linville --- Reading git-diff-tree failed