fs_lock:Avoid deadlock caused by KILL SIGNAL

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
chenrun1 2024-02-01 17:46:28 +08:00 committed by Alan Carvalho de Assis
parent 6e3e03f6b0
commit ae730ac246

View File

@ -36,6 +36,7 @@
#include <nuttx/list.h>
#include "lock.h"
#include "sched/sched.h"
/****************************************************************************
* Pre-processor Definitions
@ -94,9 +95,12 @@ static mutex_t g_protect_lock = NXMUTEX_INITIALIZER;
static int file_lock_get_path(FAR struct file *filep, FAR char *path)
{
FAR struct tcb_s *tcb = this_task();
/* We only apply file lock on mount points (f_inode won't be NULL). */
if (!INODE_IS_MOUNTPT(filep->f_inode))
if (!INODE_IS_MOUNTPT(filep->f_inode) ||
tcb->flags & TCB_FLAG_SIGNAL_ACTION)
{
return -EBADF;
}