Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ipmi:ssif: Clean up kthread on errors

If an error occurs after the ssif kthread is created, but before the
main IPMI code starts the ssif interface, the ssif kthread will not
be stopped.

So make sure the kthread is stopped on an error condition if it is
running.

Fixes: 259307074bfc ("ipmi: Add SMBus interface driver (SSIF)")
Reported-by: Li Xiao <<252270051@hdu.edu.cn>
Cc: stable@vger.kernel.org
Reviewed-by: Li Xiao <252270051@hdu.edu.cn>
Signed-off-by: Corey Minyard <corey@minyard.net>

+12 -1
+12 -1
drivers/char/ipmi/ipmi_ssif.c
··· 1268 1268 ssif_info->stopping = true; 1269 1269 timer_delete_sync(&ssif_info->watch_timer); 1270 1270 timer_delete_sync(&ssif_info->retry_timer); 1271 - if (ssif_info->thread) 1271 + if (ssif_info->thread) { 1272 1272 kthread_stop(ssif_info->thread); 1273 + ssif_info->thread = NULL; 1274 + } 1273 1275 } 1274 1276 1275 1277 static void ssif_remove(struct i2c_client *client) ··· 1914 1912 1915 1913 out: 1916 1914 if (rv) { 1915 + /* 1916 + * If ipmi_register_smi() starts the interface, it will 1917 + * call shutdown and that will free the thread and set 1918 + * it to NULL. Otherwise it must be freed here. 1919 + */ 1920 + if (ssif_info->thread) { 1921 + kthread_stop(ssif_info->thread); 1922 + ssif_info->thread = NULL; 1923 + } 1917 1924 if (addr_info) 1918 1925 addr_info->client = NULL; 1919 1926