Explorar o código

RTX5: Fixed potential corruption of terminated threads list (updated previous commit).

Robert Rostohar %!s(int64=9) %!d(string=hai) anos
pai
achega
0c3fc19df2

+ 6 - 0
CMSIS/DoxyGen/RTOS2/src/cmsis_os2.txt

@@ -146,6 +146,12 @@ File/Folder                  | Content
       <th>Version</th>
       <th>Description</th>
     </tr>
+    <tr>
+      <td>V5.1.1</td>
+      <td>
+       - Fixed potential corruption of terminated threads list.
+      </td>
+    </tr>
     <tr>
       <td>V5.1.0</td>
       <td>

+ 2 - 2
CMSIS/RTOS2/RTX/Include/rtx_os.h

@@ -38,8 +38,8 @@ extern "C"
  
 /// Kernel Information
 #define osRtxVersionAPI      20010000   ///< API version (2.1.0)
-#define osRtxVersionKernel   50010000   ///< Kernel version (5.1.0)
-#define osRtxKernelId     "RTX V5.1.0"  ///< Kernel identification string
+#define osRtxVersionKernel   50010001   ///< Kernel version (5.1.1)
+#define osRtxKernelId     "RTX V5.1.1"  ///< Kernel identification string
  
  
 //  ==== Common definitions ====

+ 6 - 2
CMSIS/RTOS2/RTX/Source/rtx_thread.c

@@ -1176,8 +1176,10 @@ void svcRtxThreadExit (void) {
     // Update Thread State and put it into Terminate Thread list
     thread->state = osRtxThreadTerminated;
     thread->thread_prev = NULL;
-    osRtxInfo.thread.terminate_list->thread_prev = thread;
     thread->thread_next = osRtxInfo.thread.terminate_list;
+    if (osRtxInfo.thread.terminate_list != NULL) {
+      osRtxInfo.thread.terminate_list->thread_prev = thread;
+    }
     osRtxInfo.thread.terminate_list = thread;
   }
 
@@ -1242,8 +1244,10 @@ osStatus_t svcRtxThreadTerminate (osThreadId_t thread_id) {
     // Update Thread State and put it into Terminate Thread list
     thread->state = osRtxThreadTerminated;
     thread->thread_prev = NULL;
-    osRtxInfo.thread.terminate_list->thread_prev = thread;
     thread->thread_next = osRtxInfo.thread.terminate_list;
+    if (osRtxInfo.thread.terminate_list != NULL) {
+      osRtxInfo.thread.terminate_list->thread_prev = thread;
+    }
     osRtxInfo.thread.terminate_list = thread;
   }