From 7347684e5f7d63bcbe771363f1f15664e8aed270 Mon Sep 17 00:00:00 2001 From: anjiahao Date: Tue, 7 Feb 2023 20:49:04 +0800 Subject: [PATCH] mempool:fix bug when list needs to be protected by a lock Signed-off-by: anjiahao --- mm/mempool/mempool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/mempool/mempool.c b/mm/mempool/mempool.c index 124e689d2a..3921352914 100644 --- a/mm/mempool/mempool.c +++ b/mm/mempool/mempool.c @@ -394,6 +394,8 @@ int mempool_info(FAR struct mempool_s *pool, FAR struct mempoolinfo_s *info) int mempool_info_task(FAR struct mempool_s *pool, FAR struct mempoolinfo_task *info) { + irqstate_t flags = spin_lock_irqsave(&pool->lock); + DEBUGASSERT(info); if (info->pid == -2) { @@ -438,6 +440,7 @@ int mempool_info_task(FAR struct mempool_s *pool, } #endif + spin_unlock_irqrestore(&pool->lock, flags); return OK; }