diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-09-18 17:38:59 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-11-19 12:57:14 -0500 |
commit | 986cdb862e4aafc92a1537e04388898fc42b8bc0 (patch) | |
tree | b35bba257013e6cb869cc51d8ced93fc05e5e764 /fs/gfs2 | |
parent | cac7f2429872d3733dc3f9915857b1691da2eb2f (diff) |
gfs2: bugger off early if O_CREAT open finds a directory
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/inode.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index c4ed823d150..310e2487239 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -624,6 +624,11 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, inode = gfs2_dir_search(dir, &dentry->d_name, !S_ISREG(mode) || excl); error = PTR_ERR(inode); if (!IS_ERR(inode)) { + if (S_ISDIR(inode->i_mode)) { + iput(inode); + inode = ERR_PTR(-EISDIR); + goto fail_gunlock; + } d = d_splice_alias(inode, dentry); error = PTR_ERR(d); if (IS_ERR(d)) { |