From: Max Kellermann Date: Tue, 24 Feb 2026 13:26:57 +0000 (+0100) Subject: fs/ceph/mds_client: fix memory leaks in ceph_mdsc_build_path() X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7368dcf06052074a7c09b04df3287cadf06f60cb;p=ceph-client.git fs/ceph/mds_client: fix memory leaks in ceph_mdsc_build_path() Add __putname() calls to error code paths that did not free the "path" pointer obtained by __getname(). If ownership of this pointer is not passed to the caller via path_info.path, the function must free it before returning. Fixes: 3fd945a79e14 ("ceph: encode encrypted name in ceph_mdsc_build_path and dentry release") Fixes: 550f7ca98ee0 ("ceph: give up on paths longer than PATH_MAX") Cc: stable@vger.kernel.org Signed-off-by: Max Kellermann Reviewed-by: Viacheslav Dubeyko --- diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 61be770c7486..351e0008a4fa 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -2809,6 +2809,7 @@ retry: if (ret < 0) { dput(parent); dput(cur); + __putname(path); return ERR_PTR(ret); } @@ -2818,6 +2819,7 @@ retry: if (len < 0) { dput(parent); dput(cur); + __putname(path); return ERR_PTR(len); } } @@ -2854,6 +2856,7 @@ retry: * cannot ever succeed. Creating paths that long is * possible with Ceph, but Linux cannot use them. */ + __putname(path); return ERR_PTR(-ENAMETOOLONG); }