Commit a69b41e9 authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman

staging: vchiq_core: Free kthreads in error case

We need to free the kthreads in error case before leaving
vchiq_init_state() otherwise we leak resources.
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8dd60f7d
...@@ -2562,7 +2562,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, ...@@ -2562,7 +2562,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero,
vchiq_loud_error_header(); vchiq_loud_error_header();
vchiq_loud_error("couldn't create thread %s", threadname); vchiq_loud_error("couldn't create thread %s", threadname);
vchiq_loud_error_footer(); vchiq_loud_error_footer();
return VCHIQ_ERROR; goto fail_free_handler_thread;
} }
set_user_nice(state->recycle_thread, -19); set_user_nice(state->recycle_thread, -19);
...@@ -2574,7 +2574,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, ...@@ -2574,7 +2574,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero,
vchiq_loud_error_header(); vchiq_loud_error_header();
vchiq_loud_error("couldn't create thread %s", threadname); vchiq_loud_error("couldn't create thread %s", threadname);
vchiq_loud_error_footer(); vchiq_loud_error_footer();
return VCHIQ_ERROR; goto fail_free_recycle_thread;
} }
set_user_nice(state->sync_thread, -20); set_user_nice(state->sync_thread, -20);
...@@ -2588,6 +2588,13 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, ...@@ -2588,6 +2588,13 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero,
local->initialised = 1; local->initialised = 1;
return status; return status;
fail_free_recycle_thread:
kthread_stop(state->recycle_thread);
fail_free_handler_thread:
kthread_stop(state->slot_handler_thread);
return VCHIQ_ERROR;
} }
/* Called from application thread when a client or server service is created. */ /* Called from application thread when a client or server service is created. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment