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: Richard Weinberger <richard@nod.at>
This commit is contained in:
Richard Weinberger 2015-02-27 22:56:28 +01:00
parent 69886e676e
commit af9556586a

View File

@ -329,6 +329,7 @@ static int hostfs_file_open(struct inode *ino, struct file *file)
/* somebody else had handled it first? */
if ((mode & HOSTFS_I(ino)->mode) == mode) {
mutex_unlock(&HOSTFS_I(ino)->open_mutex);
close_file(&fd);
return 0;
}
if ((mode | HOSTFS_I(ino)->mode) != mode) {