summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-05-28 20:38:12 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-05-28 20:38:12 +0000
commit7c8d65e83558f0d90526b28cba00c5c0aef7ada0 (patch)
tree2f2289a752951f481a3568cd6ccb4b6c52c5f2cc /cpukit/score
parent86abd5b98475a53846d51d6298a5cdaa6c727e4e (diff)
downloadrtems-7c8d65e83558f0d90526b28cba00c5c0aef7ada0.tar.bz2
2009-05-28 Joel Sherrill <joel.sherrill@OARcorp.com>
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.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/include/rtems/score/coremutex.h6
-rw-r--r--cpukit/score/inline/rtems/score/coremutex.inl3
-rw-r--r--cpukit/score/src/coremutex.c7
3 files changed, 12 insertions, 4 deletions
diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h
index 73a68189d8..35007652c8 100644
--- a/cpukit/score/include/rtems/score/coremutex.h
+++ b/cpukit/score/include/rtems/score/coremutex.h
@@ -8,7 +8,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2008.
+ * COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -257,8 +257,10 @@ typedef struct {
* @param[in] the_mutex_attributes is the attributes associated with this
* mutex instance
* @param[in] initial_lock is the initial value of the mutex
+ *
+ * @return This method returns CORE_MUTEX_STATUS_SUCCESSFUL if successful.
*/
-void _CORE_mutex_Initialize(
+CORE_mutex_Status _CORE_mutex_Initialize(
CORE_mutex_Control *the_mutex,
CORE_mutex_Attributes *the_mutex_attributes,
uint32_t initial_lock
diff --git a/cpukit/score/inline/rtems/score/coremutex.inl b/cpukit/score/inline/rtems/score/coremutex.inl
index 7680f98561..bcb86058fe 100644
--- a/cpukit/score/inline/rtems/score/coremutex.inl
+++ b/cpukit/score/inline/rtems/score/coremutex.inl
@@ -6,7 +6,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2006.
+ * COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -185,6 +185,7 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
}
/* if ( current < ceiling ) */ {
executing->Wait.return_code = CORE_MUTEX_STATUS_CEILING_VIOLATED;
+ the_mutex->lock = CORE_MUTEX_UNLOCKED;
the_mutex->nest_count = 0; /* undo locking above */
executing->resource_count--; /* undo locking above */
_ISR_Enable( level );
diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c
index 24b36cbef1..6d8a64e75d 100644
--- a/cpukit/score/src/coremutex.c
+++ b/cpukit/score/src/coremutex.c
@@ -42,7 +42,7 @@
* Output parameters: NONE
*/
-void _CORE_mutex_Initialize(
+CORE_mutex_Status _CORE_mutex_Initialize(
CORE_mutex_Control *the_mutex,
CORE_mutex_Attributes *the_mutex_attributes,
uint32_t initial_lock
@@ -65,6 +65,9 @@ void _CORE_mutex_Initialize(
if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
+ if ( _Thread_Executing->current_priority <
+ the_mutex->Attributes.priority_ceiling )
+ return CORE_MUTEX_STATUS_CEILING_VIOLATED;
#ifdef __RTEMS_STRICT_ORDER_MUTEX__
_Chain_Prepend_unprotected( &_Thread_Executing->lock_mutex,
&the_mutex->queue.lock_queue );
@@ -86,4 +89,6 @@ void _CORE_mutex_Initialize(
STATES_WAITING_FOR_MUTEX,
CORE_MUTEX_TIMEOUT
);
+
+ return CORE_MUTEX_STATUS_SUCCESSFUL;
}