From 288725a5f8b50fa8f8c32fb963dafca0467a1913 Mon Sep 17 00:00:00 2001 From: anjiahao Date: Thu, 1 Dec 2022 00:35:25 +0800 Subject: [PATCH] mempool:fix a bug when use smp on mempool backtrace Signed-off-by: anjiahao --- mm/mempool/mempool.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/mempool/mempool.c b/mm/mempool/mempool.c index d1ee35caf2..10186c2aa9 100644 --- a/mm/mempool/mempool.c +++ b/mm/mempool/mempool.c @@ -317,7 +317,7 @@ out_with_lock: void mempool_free(FAR struct mempool_s *pool, FAR void *blk) { - irqstate_t flags; + irqstate_t flags = spin_lock_irqsave(&pool->lock); #if CONFIG_MM_BACKTRACE >= 0 size_t blocksize = ALIGN_UP(pool->blocksize + sizeof(struct mempool_backtrace_s), @@ -332,8 +332,6 @@ void mempool_free(FAR struct mempool_s *pool, FAR void *blk) pool->nalloc--; #endif - flags = spin_lock_irqsave(&pool->lock); - if (pool->interruptsize > blocksize) { if ((FAR char *)blk >= pool->ibase &&