]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gfs2: gfs2_create_inode error handling fix
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 18 Apr 2025 14:40:58 +0000 (16:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:05:09 +0000 (11:05 +0100)
[ Upstream commit af4044fd0b77e915736527dd83011e46e6415f01 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/gfs2/inode.c

index 763d8dccdfc133ffbbd6d7c1a6c7bd8f2e4e01b4..a7af9904e3edbec53ceb80e7944b050f8ad8d278 100644 (file)
@@ -640,7 +640,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);