Changeset ee2e3a1 in rtems


Ignore:
Timestamp:
May 28, 2009, 8:38:22 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.9
Children:
7920d156
Parents:
ff6b3fe
Message:

2009-05-28 Joel Sherrill <joel.sherrill@…>

PR 1415/cpukit

  • rtems/src/semcreate.c, rtems/src/semtranslatereturncode.c, score/include/rtems/score/coremutex.h, score/inline/rtems/score/coremutex.inl, score/src/coremutex.c: Address two paths where a task with a priority above the ceiling could obtain a priority ceiling mutex.
Location:
cpukit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    rff6b3fe ree2e3a1  
     12009-05-28      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        PR 1415/cpukit
     4        * rtems/src/semcreate.c, rtems/src/semtranslatereturncode.c,
     5        score/include/rtems/score/coremutex.h,
     6        score/inline/rtems/score/coremutex.inl, score/src/coremutex.c:
     7        Address two paths where a task with a priority above the ceiling
     8        could obtain a priority ceiling mutex.
     9
    1102009-05-21      Joel Sherrill <joel.sherrill@OARcorp.com>
    211
  • cpukit/rtems/src/semcreate.c

    rff6b3fe ree2e3a1  
    8181  CORE_mutex_Attributes       the_mutex_attributes;
    8282  CORE_semaphore_Attributes   the_semaphore_attributes;
    83   uint32_t                    lock;
    8483
    8584  if ( !rtems_is_name_valid( name ) )
     
    147146
    148147  if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
     148    CORE_mutex_Status mutex_status;
     149
    149150    if ( _Attributes_Is_inherit_priority( attribute_set ) )
    150151      the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
     
    177178    the_mutex_attributes.priority_ceiling = priority_ceiling;
    178179
    179     if ( count == 1 )
    180       lock = CORE_MUTEX_UNLOCKED;
    181     else
    182       lock = CORE_MUTEX_LOCKED;
    183 
    184     _CORE_mutex_Initialize(
     180    mutex_status = _CORE_mutex_Initialize(
    185181      &the_semaphore->Core_control.mutex,
    186182      &the_mutex_attributes,
    187       lock
    188     );
     183      (count == 1) ? CORE_MUTEX_UNLOCKED : CORE_MUTEX_LOCKED
     184     );
     185
     186     if ( mutex_status == CORE_MUTEX_STATUS_CEILING_VIOLATED ) {
     187       _Semaphore_Free( the_semaphore );
     188       _Thread_Enable_dispatch();
     189       return RTEMS_INVALID_PRIORITY;
     190     }
    189191  } else {
    190192    if ( _Attributes_Is_priority( attribute_set ) )
  • cpukit/rtems/src/semtranslatereturncode.c

    rff6b3fe ree2e3a1  
    1616 *     + release a semaphore
    1717 *
    18  *  COPYRIGHT (c) 1989-2007.
     18 *  COPYRIGHT (c) 1989-2009.
    1919 *  On-Line Applications Research Corporation (OAR).
    2020 *
     
    7272    CORE_MUTEX_RELEASE_NOT_ORDER,
    7373#endif
    74   RTEMS_INTERNAL_ERROR     /* CORE_MUTEX_STATUS_CEILING_VIOLATED */
     74  RTEMS_INVALID_PRIORITY   /* CORE_MUTEX_STATUS_CEILING_VIOLATED */
    7575};
    76 
    7776
    7877rtems_status_code _Semaphore_Translate_core_mutex_return_code (
  • cpukit/score/include/rtems/score/coremutex.h

    rff6b3fe ree2e3a1  
    99
    1010/*
    11  *  COPYRIGHT (c) 1989-2008.
     11 *  COPYRIGHT (c) 1989-2009.
    1212 *  On-Line Applications Research Corporation (OAR).
    1313 *
     
    258258 *         mutex instance
    259259 *  @param[in] initial_lock is the initial value of the mutex
    260  */
    261 void _CORE_mutex_Initialize(
     260 *
     261 *  @return This method returns CORE_MUTEX_STATUS_SUCCESSFUL if successful.
     262 */
     263CORE_mutex_Status _CORE_mutex_Initialize(
    262264  CORE_mutex_Control           *the_mutex,
    263265  CORE_mutex_Attributes        *the_mutex_attributes,
  • cpukit/score/inline/rtems/score/coremutex.inl

    rff6b3fe ree2e3a1  
    77
    88/*
    9  *  COPYRIGHT (c) 1989-2006.
     9 *  COPYRIGHT (c) 1989-2009.
    1010 *  On-Line Applications Research Corporation (OAR).
    1111 *
     
    186186      /* if ( current < ceiling ) */ {
    187187        executing->Wait.return_code = CORE_MUTEX_STATUS_CEILING_VIOLATED;
     188        the_mutex->lock       = CORE_MUTEX_UNLOCKED;
    188189        the_mutex->nest_count = 0;     /* undo locking above */
    189190        executing->resource_count--;   /* undo locking above */
  • cpukit/score/src/coremutex.c

    rff6b3fe ree2e3a1  
    4343 */
    4444
    45 void _CORE_mutex_Initialize(
     45CORE_mutex_Status _CORE_mutex_Initialize(
    4646  CORE_mutex_Control           *the_mutex,
    4747  CORE_mutex_Attributes        *the_mutex_attributes,
     
    6666         _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
    6767     
     68      if ( _Thread_Executing->current_priority <
     69             the_mutex->Attributes.priority_ceiling )
     70       return CORE_MUTEX_STATUS_CEILING_VIOLATED;
    6871#ifdef __RTEMS_STRICT_ORDER_MUTEX__
    6972       _Chain_Prepend_unprotected( &_Thread_Executing->lock_mutex,
     
    8790    CORE_MUTEX_TIMEOUT
    8891  );
     92
     93  return CORE_MUTEX_STATUS_SUCCESSFUL;
    8994}
Note: See TracChangeset for help on using the changeset viewer.