Files
linux/fs
WenTao Liang c3e64079d8 ceph: fix refcount leak in ceph_readdir()
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>
2026-07-23 20:29:41 +02:00
..
2026-05-21 13:39:35 +02:00
2026-05-21 13:39:35 +02:00
2026-06-11 11:42:21 -07:00
2026-07-01 15:26:47 +02:00
2026-01-02 13:43:41 -05:00
2026-07-01 15:26:47 +02:00
2026-05-21 13:39:36 +02:00
2026-05-21 13:39:35 +02:00
2026-01-12 16:52:09 +01:00