Skip to content

Commit 6bd0eb6

Browse files
committed
ipmi:ssif: Fix a shutdown race
It was possible for the SSIF thread to stop and quit before the kthread_stop() call because ssif->stopping was set before the stop. So only exit the SSIF thread is kthread_should_stop() returns true. There is no need to wake the thread, as the wait will be interrupted by kthread_stop(). Signed-off-by: Corey Minyard <cminyard@mvista.com>
1 parent 87105e0 commit 6bd0eb6

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

drivers/char/ipmi/ipmi_ssif.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,6 @@ static int ipmi_ssif_thread(void *data)
481481
/* Wait for something to do */
482482
result = wait_for_completion_interruptible(
483483
&ssif_info->wake_thread);
484-
if (ssif_info->stopping)
485-
break;
486484
if (result == -ERESTARTSYS)
487485
continue;
488486
init_completion(&ssif_info->wake_thread);
@@ -1270,10 +1268,8 @@ static void shutdown_ssif(void *send_info)
12701268
ssif_info->stopping = true;
12711269
timer_delete_sync(&ssif_info->watch_timer);
12721270
timer_delete_sync(&ssif_info->retry_timer);
1273-
if (ssif_info->thread) {
1274-
complete(&ssif_info->wake_thread);
1271+
if (ssif_info->thread)
12751272
kthread_stop(ssif_info->thread);
1276-
}
12771273
}
12781274

12791275
static void ssif_remove(struct i2c_client *client)

0 commit comments

Comments
 (0)