gfs2: gfs2_create_inode error handling fix
[ Upstream commit af4044fd0b77e915736527dd83011e46e6415f01 ]
When gfs2_create_inode() finds a directory, make sure to return -EISDIR.
Fixes: 571a4b5797
("GFS2: bugger off early if O_CREAT open finds a directory")
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
76c7b1407a
commit
eec0dd17db
@@ -658,7 +658,8 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
|
|||||||
if (!IS_ERR(inode)) {
|
if (!IS_ERR(inode)) {
|
||||||
if (S_ISDIR(inode->i_mode)) {
|
if (S_ISDIR(inode->i_mode)) {
|
||||||
iput(inode);
|
iput(inode);
|
||||||
inode = ERR_PTR(-EISDIR);
|
inode = NULL;
|
||||||
|
error = -EISDIR;
|
||||||
goto fail_gunlock;
|
goto fail_gunlock;
|
||||||
}
|
}
|
||||||
d_instantiate(dentry, inode);
|
d_instantiate(dentry, inode);
|
||||||
|
Reference in New Issue
Block a user