[PATCH 02/11] 9p: fix dentry leak in v9fs_vfs_atomic_open_dotl()

From: Miklos Szeredi
Date: Mon Sep 16 2013 - 08:54:27 EST


From: Miklos Szeredi <mszeredi@xxxxxxx>

commit b6f4bee02f "fs/9p: Fix atomic_open" fixed the O_EXCL behavior, but
results in a dentry leak if v9fs_vfs_lookup() returns non-NULL.

Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxx>
Cc: Eric Van Hensbergen <ericvh@xxxxxxxxx>
Cc: M. Mohan Kumar <mohan@xxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
---
fs/9p/vfs_inode_dotl.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 53687bb..055c159 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -270,10 +270,11 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
if (!(flags & O_CREAT))
return finish_no_open(file, res);
else if (dentry->d_inode) {
- if ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
- return -EEXIST;
- else
- return finish_no_open(file, res);
+ err = -EEXIST;
+ if (flags & O_EXCL)
+ goto out;
+
+ return finish_no_open(file, res);
}

v9ses = v9fs_inode2v9ses(dir);
--
1.8.1.4

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