提交 af955658 编写于 作者: R Richard Weinberger

hostfs: hostfs_file_open: Fix a fd leak in hostfs_file_open

In case of a race between to callers of hostfs_file_open()
it can happen that a file describtor is leaked.
Signed-off-by: NRichard Weinberger <richard@nod.at>
上级 69886e67
...@@ -329,6 +329,7 @@ static int hostfs_file_open(struct inode *ino, struct file *file) ...@@ -329,6 +329,7 @@ static int hostfs_file_open(struct inode *ino, struct file *file)
/* somebody else had handled it first? */ /* somebody else had handled it first? */
if ((mode & HOSTFS_I(ino)->mode) == mode) { if ((mode & HOSTFS_I(ino)->mode) == mode) {
mutex_unlock(&HOSTFS_I(ino)->open_mutex); mutex_unlock(&HOSTFS_I(ino)->open_mutex);
close_file(&fd);
return 0; return 0;
} }
if ((mode | HOSTFS_I(ino)->mode) != mode) { if ((mode | HOSTFS_I(ino)->mode) != mode) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册