summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2025-04-18 16:40:58 +0200
committerAndreas Gruenbacher <agruenba@redhat.com>2025-04-21 18:20:36 +0200
commitaf4044fd0b77e915736527dd83011e46e6415f01 (patch)
treed71e2b1a7b7dfdac920491696b974be81ea295a3
parent4023c3cbc38f891c0d54d45a0ba0a1b4c289214a (diff)
gfs2: gfs2_create_inode error handling fix
When gfs2_create_inode() finds a directory, make sure to return -EISDIR. Fixes: 571a4b57975a ("GFS2: bugger off early if O_CREAT open finds a directory") Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
-rw-r--r--fs/gfs2/inode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 198a8cbaf5e5..9621680814b8 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -659,7 +659,8 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
if (!IS_ERR(inode)) {
if (S_ISDIR(inode->i_mode)) {
iput(inode);
- inode = ERR_PTR(-EISDIR);
+ inode = NULL;
+ error = -EISDIR;
goto fail_gunlock;
}
d_instantiate(dentry, inode);