Commit 44e518ab authored by Ilya Dryomov's avatar Ilya Dryomov Committed by Greg Kroah-Hartman
Browse files

ceph: fix memory leak in ceph_direct_read_write()



[ Upstream commit 66e0c4f9 ]

The bvecs array which is allocated in iter_get_bvecs_alloc() is leaked
and pages remain pinned if ceph_alloc_sparse_ext_map() fails.

There is no need to delay the allocation of sparse_ext map until after
the bvecs array is set up, so fix this by moving sparse_ext allocation
a bit earlier.  Also, make a similar adjustment in __ceph_sync_read()
for consistency (a leak of the same kind in __ceph_sync_read() has been
addressed differently).

Cc: stable@vger.kernel.org
Fixes: 03bc06c7 ("ceph: add new mount option to enable sparse reads")
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
Reviewed-by: default avatarAlex Markuze <amarkuze@redhat.com>
Stable-dep-of: 18d44c5d ("ceph: allocate sparse_ext map only for sparse reads")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent fb98248f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment