summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-11 15:43:23 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-11 15:47:02 +0200
commitdd734d467d6e0961a88bdabbafccede6cccb2156 (patch)
treea47e332db77339a932abe10bd34a71343737d652
parente563e61c7aa22e87d5d0631011b80622be5b4557 (diff)
downloadrtems-dd734d467d6e0961a88bdabbafccede6cccb2156.tar.bz2
score: Fix _Thread_Initialize()
Fix an error cleanup path in SMP configurations to avoid a NULL pointer access. Update #3959.
-rw-r--r--cpukit/score/src/threadinitialize.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 4a74426498..4c6d849111 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -60,7 +60,6 @@ bool _Thread_Initialize(
}
/* Set everything to perform the error case clean up */
- scheduler_index = 0;
the_thread->Start.stack_free = config->stack_free;
#if defined(RTEMS_SMP)
@@ -153,6 +152,7 @@ bool _Thread_Initialize(
scheduler_node = NULL;
scheduler_node_for_index = the_thread->Scheduler.nodes;
scheduler_for_index = &_Scheduler_Table[ 0 ];
+ scheduler_index = 0;
while ( scheduler_index < _Scheduler_Count ) {
Priority_Control priority_for_index;
@@ -255,10 +255,6 @@ bool _Thread_Initialize(
if ( extension_status )
return true;
-#if defined(RTEMS_SMP) || CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE
-failed:
-#endif
-
#if defined(RTEMS_SMP)
while ( scheduler_index > 0 ) {
scheduler_node_for_index = (Scheduler_Node *)
@@ -277,6 +273,11 @@ failed:
&information->Thread_queue_heads.Free,
the_thread->Wait.spare_heads
);
+
+#if defined(RTEMS_SMP) || CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE
+failed:
+#endif
+
( *the_thread->Start.stack_free )( the_thread->Start.Initial_stack.area );
return false;
}