Skip to content

Commit ae730ac

Browse files
crafcat7acassis
authored andcommitted
fs_lock:Avoid deadlock caused by KILL SIGNAL
Signed-off-by: chenrun1 <[email protected]>
1 parent 6e3e03f commit ae730ac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/vfs/fs_lock.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <nuttx/list.h>
3737

3838
#include "lock.h"
39+
#include "sched/sched.h"
3940

4041
/****************************************************************************
4142
* Pre-processor Definitions
@@ -94,9 +95,12 @@ static mutex_t g_protect_lock = NXMUTEX_INITIALIZER;
9495

9596
static int file_lock_get_path(FAR struct file *filep, FAR char *path)
9697
{
98+
FAR struct tcb_s *tcb = this_task();
99+
97100
/* We only apply file lock on mount points (f_inode won't be NULL). */
98101

99-
if (!INODE_IS_MOUNTPT(filep->f_inode))
102+
if (!INODE_IS_MOUNTPT(filep->f_inode) ||
103+
tcb->flags & TCB_FLAG_SIGNAL_ACTION)
100104
{
101105
return -EBADF;
102106
}

0 commit comments

Comments
 (0)