[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <871u07wkwt.fsf@xmission.com>
Date: Thu, 16 Jan 2014 15:45:38 -0800
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Al Viro <viro@...IV.linux.org.uk>
Cc: <linux-fsdevel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH] vfs: Don't leak a path when get_empty_filp in dentry_open
Normally in dentry_open the passed in path is placed on the new filp
removing the caller from needing to worry about it. In the rare case
that we can not allocate a filp the path is not consumed. None of the
callers of dentry_open call path_put in their error handling when
dentry_open fails so call path_put for them on error and keep everyone's
error handling simple.
Cc: stable@...r.kernel.org
Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
---
fs/open.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/open.c b/fs/open.c
index 4b3e1edf2fe4..0afa243941da 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -843,6 +843,8 @@ struct file *dentry_open(const struct path *path, int flags,
put_filp(f);
f = ERR_PTR(error);
}
+ } else {
+ path_put(path);
}
return f;
}
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists