Files
WenTao Liang cb9c9ec479 ceph: fix refcount leak in ceph_readdir()
[ Upstream commit c3e64079d8 ]

The ceph_readdir() function allocates a ceph_mds_request via
ceph_mdsc_create_request() and stores it in dfi->last_readdir. In
the directory entry processing loop, if the entry's offset is less
than ctx->pos or if the inode pointer is unexpectedly NULL, the
function returns -EIO without releasing the reference held by
dfi->last_readdir, causing a refcount leak.

Fix this by adding ceph_mdsc_put_request(dfi->last_readdir) before
returning on these error paths. Also set dfi->last_readdir to NULL
for safety, matching the cleanup done at the normal exit.

Cc: stable@vger.kernel.org
Fixes: af9ffa6df7 ("ceph: add support to readdir for encrypted names")
Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
Reviewed-by: Alex Markuze <amarkuze@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-08-09 20:22:04 +02:00
..
…
…
2026-07-24 16:03:10 +02:00
2026-08-09 20:21:50 +02:00
2026-03-04 07:20:43 -05:00
2026-01-17 16:30:00 +01:00
…
…
…
…
…
2025-03-22 12:50:41 -07:00
2026-07-24 16:03:53 +02:00
…
…
…
…
…
2026-07-04 13:42:23 +02:00
…
…
…
2026-07-04 13:42:23 +02:00
…
2026-01-11 15:22:23 +01:00
…
…
…
…
…
2026-07-04 13:42:23 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
2026-04-06 09:55:59 +02:00