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 <[email protected]>
---
 fs/hostfs/hostfs_kern.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 104d58d..112ba5a 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) {
-- 
2.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to