locking/ww_mutex: fix missing destroy_workqueue() on error in test_ww_mutex_init()
PATCH 1/1 locking/ww_mutex: fix missing destroy_workqueue() on error in test_ww_mutex_init()
If test_ww_mutex_init() failed, the module won't be loaded, so test_ww_mutex_exit() can not be called, in this case, wq will be leaked, fix it by adding destroy_workqueue() on error path of test_ww_mutex_init().
Fixes d1b42b800e5d ("locking/ww_mutex: Add kselftests for resolving...")
Reported-by Hulk Robot <[email protected]>
Signed-off-by Yang Yingliang <[email protected]>
--- kernel/locking/test-ww_mutex.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
kernel/locking/test-ww_mutex.c +12 -8
@@ -589,37 +589,41 @@ static int __init test_ww_mutex_init(void) ret =test_mutex ();if (ret) -return ret; + goto out; ret =test_aa ();if (ret) -return ret; + goto out; ret =test_abba (false);if (ret) -return ret; + goto out; ret =test_abba (true);if (ret) -return ret; + goto out; ret =test_cycle (ncpus);if (ret) -return ret; + goto out; ret =stress (16 ,2 *ncpus,STRESS_INORDER );if (ret) -return ret; + goto out; ret =stress (16 ,2 *ncpus,STRESS_REORDER );if (ret) -return ret; + goto out; ret =stress (4095 ,hweight32 (STRESS_ALL )*ncpus,STRESS_ALL );if (ret) -return ret; + goto out;return 0 ; + +out: +destroy_workqueue (wq); +return ret; } static void __exit test_ww_mutex_exit(void)
Signature · 1 line
2.25.1