mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 01:42:58 +08:00
fs: Fix the race condition in file_dup
NULL inode passed to files_allocate doesn't mark file struct in the allocated state, so other threads which invovle in file allocation (e.g. open or dup) may allocate the same file struct again. Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: I53ff876eae3c7a1e311e7f671686b73a4b4ef891
This commit is contained in:
@@ -408,7 +408,7 @@ struct file
|
||||
int f_oflags; /* Open mode flags */
|
||||
off_t f_pos; /* File position */
|
||||
FAR struct inode *f_inode; /* Driver or file system interface */
|
||||
void *f_priv; /* Per file driver private data */
|
||||
FAR void *f_priv; /* Per file driver private data */
|
||||
};
|
||||
|
||||
/* This defines a list of files indexed by the file descriptor */
|
||||
|
||||
Reference in New Issue
Block a user