Skip to contentSkip to conversation

gfs2: gfs2_create_inode error handling fix

PATCH New Andreas Gruenbacher 1 participant 1 message Apr 22, 2025 GFS2 file system

lore
Share & tools
lore

Andreas Gruenbacher

author maintainer
#0 lore raw

PATCH 1/1 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")
---
 fs/gfs2/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/gfs2/inode.c +2 -1
index 198a8cbaf5e5..9621680814b8 100644
@@ -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);
Signature · 1 line
2.49.0