Skip to content

Commit 6301738

Browse files
committed
Fix: Invalidate MPU object pool entry on timer delete in MPU wrappers v2
1 parent a8c9d35 commit 6301738

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

portable/Common/mpu_wrappers_v2.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3541,6 +3541,15 @@
35413541
pxParams->xOptionalValue,
35423542
pxParams->pxHigherPriorityTaskWoken,
35433543
pxParams->xTicksToWait );
3544+
3545+
/* Timer deletion is asynchronous - eagerly invalidate the
3546+
* object pool entry only if the delete command was successfully
3547+
* queued, to prevent stale handle access after the timer daemon
3548+
* frees the Timer_t. */
3549+
if( ( xReturn == pdPASS ) && ( pxParams->xCommandID == tmrCOMMAND_DELETE ) )
3550+
{
3551+
MPU_SetIndexFreeInKernelObjectPool( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
3552+
}
35443553
}
35453554
}
35463555
}

0 commit comments

Comments
 (0)