summaryrefslogtreecommitdiffstats
path: root/fs/hostfs
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2015-02-27 22:56:28 +0100
committerRichard Weinberger <richard@nod.at>2015-03-26 23:27:48 +0100
commitaf9556586a906106453ff7df8bcacf795b2b7d0a (patch)
tree5a8e8d173a9422b3616d6f4418510fff7720ae03 /fs/hostfs
parent69886e676e89534953b12df77382504a7731f7bb (diff)
downloadlinux-af9556586a906106453ff7df8bcacf795b2b7d0a.tar.gz
linux-af9556586a906106453ff7df8bcacf795b2b7d0a.tar.bz2
linux-af9556586a906106453ff7df8bcacf795b2b7d0a.zip
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>
Diffstat (limited to 'fs/hostfs')
-rw-r--r--fs/hostfs/hostfs_kern.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 104d58d2c78c..112ba5aa0848 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -329,6 +329,7 @@ retry:
/* 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) {