Changeset e3f6d35 in rtems


Ignore:
Timestamp:
Jan 2, 2020, 10:45:30 PM (7 weeks ago)
Author:
Gedare Bloom <gedare@…>
Branches:
4.10
Parents:
e816b4e
git-author:
Gedare Bloom <gedare@…> (01/02/20 22:45:30)
git-committer:
Gedare Bloom <gedare@…> (01/03/20 16:10:09)
Message:

cpukit/score: avoid NULL and races in priority mutex

The PIP modifications from #3359 introduced new data structures
to track priority inheritance. Prioritized mutexes without PIP
share some of the code paths, and may result in NULL pointer
accesses. This patch checks for NULL, and also adds ISR critical
sections to an uncovered corner case during thread restarts.

Closes #3829.

Location:
cpukit/score/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/threadqextractpriority.c

    re816b4e re3f6d35  
    110110
    111111  mutex = _Thread_Dequeue_priority_node( &the_thread->Priority_node );
    112   _Thread_Evaluate_priority( mutex->holder );
     112  if ( mutex != NULL ) {
     113    _Thread_Evaluate_priority( mutex->holder );
     114  }
    113115
    114116  if ( !_Watchdog_Is_active( &the_thread->Timer ) ) {
  • cpukit/score/src/threadreset.c

    re816b4e re3f6d35  
    4949{
    5050  CORE_mutex_Control *mutex;
     51  ISR_Level              level;
    5152
    5253  the_thread->resource_count   = 0;
     
    6768  }
    6869
     70  _ISR_Disable( level );
    6971  if ( the_thread->Priority_node.waiting_to_hold != NULL ) {
    7072    mutex = _Thread_Dequeue_priority_node( &the_thread->Priority_node );
    7173    _Thread_Evaluate_priority( mutex->holder );
    7274  }
     75  _ISR_Enable( level );
    7376
     77  _ISR_Disable( level );
    7478  while ( !_Chain_Is_empty( &the_thread->Priority_node.Inherited_priorities ) ) {
    7579    _Thread_Dequeue_priority_node(
     
    7882      ))
    7983    );
     84    _ISR_Flash( level );
    8085  }
     86  _ISR_Enable( level );
    8187
    8288  if ( the_thread->Priority_node.current_priority != the_thread->Start.initial_priority ) {
Note: See TracChangeset for help on using the changeset viewer.