]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_ceph_new: protect from malloc failure in ceph_getcwd
authorShachar Sharon <ssharon@redhat.com>
Sun, 22 Mar 2026 17:46:13 +0000 (19:46 +0200)
committerAnoop C S <anoopcs@samba.org>
Thu, 26 Mar 2026 08:20:36 +0000 (08:20 +0000)
When ceph_getcwd returns NULL (due to out-of-memory) bail out to avoid
segfault in strlen.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Avan Thakkar <athakkar@redhat.com>
Reviewed-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
source3/modules/vfs_ceph_new.c

index 530dffe79417d2fc1e6b0f4d7b2513c6178b9737..960dfd8db812bbb2e24edfb1f3e6df3f97041a5a 100644 (file)
@@ -1057,6 +1057,9 @@ static int vfs_ceph_ll_walk(const struct vfs_handle_struct *handle,
                                return -ENOMEM);
 
        cwd = config->ceph_getcwd_fn(config->mount);
+       if (cwd == NULL) {
+               return -ENOMEM;
+       }
        cwdlen = strlen(cwd);
 
        /*