]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
hostfs: hostfs_file_open: Fix a fd leak in hostfs_file_open
authorRichard Weinberger <richard@nod.at>
Fri, 27 Feb 2015 21:56:28 +0000 (22:56 +0100)
committerRichard Weinberger <richard@nod.at>
Thu, 26 Mar 2015 22:27:48 +0000 (23:27 +0100)
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>
fs/hostfs/hostfs_kern.c

index 104d58d2c78c7c57482fe24e2637afd6106319bd..112ba5aa0848d510ad75ac73986ceb5a9312a824 100644 (file)
@@ -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) {