diff --git a/portable/Common/mpu_wrappers_v2.c b/portable/Common/mpu_wrappers_v2.c index 70082b82916..11ca6b55b3d 100644 --- a/portable/Common/mpu_wrappers_v2.c +++ b/portable/Common/mpu_wrappers_v2.c @@ -343,6 +343,38 @@ } /*-----------------------------------------------------------*/ + #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) + + static void vRevokeAccessofDeletedObjectFromAllTasks( int32_t lExternalIndexOfKernelObject ) /* PRIVILEGED_FUNCTION */ + { + int32_t i; + int32_t lInternalIndexOfKernelObject; + TaskHandle_t xInternalTaskHandle; + + if( IS_EXTERNAL_INDEX_VALID( lExternalIndexOfKernelObject ) != pdFALSE ) + { + lInternalIndexOfKernelObject = ( int32_t ) CONVERT_TO_INTERNAL_INDEX( lExternalIndexOfKernelObject ); + + for( i = 0; i < configPROTECTED_KERNEL_OBJECT_POOL_SIZE; i++ ) + { + if( xKernelObjectPool[ i ].ulKernelObjectType == KERNEL_OBJECT_TYPE_TASK ) + { + xInternalTaskHandle = ( TaskHandle_t ) xKernelObjectPool[ i ].xInternalObjectHandle; + + if( ( xInternalTaskHandle != NULL ) && + ( i != lInternalIndexOfKernelObject ) ) + { + vPortRevokeAccessToKernelObject( xInternalTaskHandle, + lInternalIndexOfKernelObject ); + } + } + } + } + } + + #endif /* #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) */ +/*-----------------------------------------------------------*/ + #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) void vGrantAccessToKernelObject( TaskHandle_t xExternalTaskHandle, @@ -1648,6 +1680,12 @@ if( lIndex != -1 ) { + #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) + { + vRevokeAccessofDeletedObjectFromAllTasks( CONVERT_TO_EXTERNAL_INDEX( lIndex ) ); + } + #endif + MPU_SetIndexFreeInKernelObjectPool( lIndex ); } @@ -1663,6 +1701,12 @@ if( xInternalTaskHandle != NULL ) { + #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) + { + vRevokeAccessofDeletedObjectFromAllTasks( lIndex ); + } + #endif + MPU_SetIndexFreeInKernelObjectPool( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); vTaskDelete( xInternalTaskHandle ); } @@ -2759,7 +2803,14 @@ if( xInternalQueueHandle != NULL ) { + #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) + { + vRevokeAccessofDeletedObjectFromAllTasks( lIndex ); + } + #endif + vQueueDelete( xInternalQueueHandle ); + MPU_SetIndexFreeInKernelObjectPool( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); } } @@ -4246,7 +4297,14 @@ if( xInternalEventGroupHandle != NULL ) { + #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) + { + vRevokeAccessofDeletedObjectFromAllTasks( lIndex ); + } + #endif + vEventGroupDelete( xInternalEventGroupHandle ); + MPU_SetIndexFreeInKernelObjectPool( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); } } @@ -4809,6 +4867,12 @@ if( xInternalStreamBufferHandle != NULL ) { + #if ( configENABLE_ACCESS_CONTROL_LIST == 1 ) + { + vRevokeAccessofDeletedObjectFromAllTasks( lIndex ); + } + #endif + vStreamBufferDelete( xInternalStreamBufferHandle ); }