summaryrefslogtreecommitdiff
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2016-09-16 16:20:42 +0300
committerIlya Dryomov <idryomov@gmail.com>2016-10-03 17:13:48 +0300
commitfa355112c2763d513f1356119684dc8a6150d08a (patch)
tree79c17910121d385b7ed4654fc3753b66eb2ce215 /drivers/block/rbd.c
parent4a17dadcae55ca1f5c1ed826d42185e22653c256 (diff)
downloadlinux-fa355112c2763d513f1356119684dc8a6150d08a.tar.xz
rbd: don't crash or leak on errors in rbd_img_obj_parent_read_full_callback()
- fix parent_length == img_request->xferred assert to not fire on copyup read failures - don't leak pages if copyup read fails or we can't allocate a new osd request Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: David Disseldorp <ddiss@suse.de>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r--drivers/block/rbd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 6db12d9a4291..77675ac8fc4c 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2674,7 +2674,7 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request)
rbd_assert(obj_request_type_valid(orig_request->type));
img_result = img_request->result;
parent_length = img_request->length;
- rbd_assert(parent_length == img_request->xferred);
+ rbd_assert(img_result || parent_length == img_request->xferred);
rbd_img_request_put(img_request);
rbd_assert(orig_request->img_request);
@@ -2727,6 +2727,7 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request)
return;
out_err:
+ ceph_release_page_vector(pages, page_count);
orig_request->result = img_result;
orig_request->xferred = 0;
rbd_img_request_get(orig_request->img_request);