Skip to content

Commit

Permalink
hostfs: hostfs_file_open: Fix a fd leak in hostfs_file_open
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Richard Weinberger committed Mar 26, 2015
1 parent 69886e6 commit af95565
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/hostfs/hostfs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit af95565

Please sign in to comment.