diff options
| author | Corey Minyard <corey@minyard.net> | 2025-04-10 22:44:26 +0300 |
|---|---|---|
| committer | Corey Minyard <corey@minyard.net> | 2025-05-08 01:25:48 +0300 |
| commit | 6bd0eb6d759b9a22c5509ea04e19c2e8407ba418 (patch) | |
| tree | 872ff7afa408d40989dddf411e7f1a08ea4d6e2e | |
| parent | 87105e07806767b81910d165441607c1461ba2b8 (diff) | |
| download | linux-6bd0eb6d759b9a22c5509ea04e19c2e8407ba418.tar.xz | |
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>
| -rw-r--r-- | drivers/char/ipmi/ipmi_ssif.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index 0b45b07dec22..5bf038e620c7 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c @@ -481,8 +481,6 @@ static int ipmi_ssif_thread(void *data) /* Wait for something to do */ result = wait_for_completion_interruptible( &ssif_info->wake_thread); - if (ssif_info->stopping) - break; if (result == -ERESTARTSYS) continue; init_completion(&ssif_info->wake_thread); @@ -1270,10 +1268,8 @@ static void shutdown_ssif(void *send_info) ssif_info->stopping = true; timer_delete_sync(&ssif_info->watch_timer); timer_delete_sync(&ssif_info->retry_timer); - if (ssif_info->thread) { - complete(&ssif_info->wake_thread); + if (ssif_info->thread) kthread_stop(ssif_info->thread); - } } static void ssif_remove(struct i2c_client *client) |
