From 78eb9f73dddadf3ce458fe5d2c4f7a7d33161e7d Mon Sep 17 00:00:00 2001 From: ligd Date: Wed, 8 Apr 2020 16:03:01 +0800 Subject: [PATCH] mm/mm_heap/mm_sem.c: add getpid() return check in mm_trysemaphore() Change-Id: Ifd56e3ccc22cf0a50f52e643b7a87aab0d0dca06 Signed-off-by: ligd --- mm/mm_heap/mm_sem.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/mm_heap/mm_sem.c b/mm/mm_heap/mm_sem.c index 2a324466501..0c34bf2436e 100644 --- a/mm/mm_heap/mm_sem.c +++ b/mm/mm_heap/mm_sem.c @@ -174,6 +174,11 @@ int mm_trysemaphore(FAR struct mm_heap_s *heap) * 'else', albeit with a nonsensical PID value. */ + if (my_pid < 0) + { + return my_pid; + } + /* Does the current task already hold the semaphore? Is the current * task actually running? */