diff options
| author | Max Kellermann <max.kellermann@ionos.com> | 2026-02-24 14:26:57 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-03-19 16:15:07 +0100 |
| commit | 13b8b9d6f59ef17fb96c298c3a0d62a8306950cc (patch) | |
| tree | cf92ac5f3973637b0813d725cfe22962c52a627f /fs/ceph | |
| parent | 2271d88125539810692f8c436f2713777337c3b4 (diff) | |
| download | linux-13b8b9d6f59ef17fb96c298c3a0d62a8306950cc.tar.gz linux-13b8b9d6f59ef17fb96c298c3a0d62a8306950cc.tar.bz2 linux-13b8b9d6f59ef17fb96c298c3a0d62a8306950cc.zip | |
ceph: fix memory leaks in ceph_mdsc_build_path()
commit 040d159a45ded7f33201421a81df0aa2a86e5a0b upstream.
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.
Cc: stable@vger.kernel.org
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")
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ceph')
| -rw-r--r-- | fs/ceph/mds_client.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index c45bd19d4b1c..109658e4d023 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -2768,6 +2768,7 @@ retry: if (ret < 0) { dput(parent); dput(cur); + __putname(path); return ERR_PTR(ret); } @@ -2777,6 +2778,7 @@ retry: if (len < 0) { dput(parent); dput(cur); + __putname(path); return ERR_PTR(len); } } @@ -2813,6 +2815,7 @@ retry: * cannot ever succeed. Creating paths that long is * possible with Ceph, but Linux cannot use them. */ + __putname(path); return ERR_PTR(-ENAMETOOLONG); } |
