]> git.hungrycats.org Git - linux/commitdiff
ceph: Fix ERR_PTR(0) in ceph_mkdir()
authorHongling Zeng <zenghongling@kylinos.cn>
Thu, 4 Jun 2026 07:43:25 +0000 (15:43 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Sep 2026 11:36:13 +0000 (13:36 +0200)
[ Upstream commit 4f49c3f8a5a86d237bb202ecb17c2802ddc8fd2f ]

When mkdir succeeds, ceph_mkdir() sets ret to ERR_PTR(0) which is
incorrect. It should return NULL instead for success.

Fixes: 88d5baf69082 ("Change inode_operations.mkdir to return struct dentry *")
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ceph/dir.c

index e4577a80da58c21bf8de59b5127952e5cc780be8..24abe4dbf774d06e5c5a9fe00b98c262dbe48d23 100644 (file)
@@ -1173,7 +1173,7 @@ static struct dentry *ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,
            !req->r_reply_info.head->is_target &&
            !req->r_reply_info.head->is_dentry)
                err = ceph_handle_notrace_create(dir, dentry);
-       ret = ERR_PTR(err);
+       ret = err ? ERR_PTR(err) : NULL;
 out_req:
        if (!IS_ERR(ret) && req->r_dentry != dentry)
                /* Some other dentry was spliced in */