siox_master_unregister() stops transfers but leaves the polling thread running. The thread retains its reference to the master and prevents the master from being released. Stop the thread after dropping the master lock, which the thread also takes, and before dropping the registration reference. This issue was found by our static analysis tool under development. Fixes: bbecb07fa0af ("siox: new driver framework for eckelmann SIOX") Cc: stable@vger.kernel.org Signed-off-by: Guangshuo Li --- drivers/siox/siox-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c index 3e8f3b6a4555..8db233ce7683 100644 --- a/drivers/siox/siox-core.c +++ b/drivers/siox/siox-core.c @@ -791,6 +791,7 @@ void siox_master_unregister(struct siox_master *smaster) siox_master_unlock(smaster); + kthread_stop(smaster->poll_thread); put_device(&smaster->dev); } EXPORT_SYMBOL_GPL(siox_master_unregister); base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4