From 0d350b6817d7905908a4e432cd359ca1d36bab50 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 17 Nov 2014 21:49:26 -0500 Subject: [PATCH] librbd: protect list_children from invalid child pool IoCtxs While listing child images, don't ignore error codes returned from librados when creating an IoCtx. This will prevent seg faults from occurring when an invalid IoCtx is used. Fixes: #10123 Backport: giant, firefly, dumpling Signed-off-by: Jason Dillaman --- src/librbd/internal.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index d88b3943539d..d84361721c08 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -429,7 +429,12 @@ namespace librbd { continue; } IoCtx ioctx; - rados.ioctx_create(it->c_str(), ioctx); + r = rados.ioctx_create(it->c_str(), ioctx); + if (r < 0) { + lderr(cct) << "Error accessing child image pool " << *it << dendl; + return r; + } + set image_ids; r = cls_client::get_children(&ioctx, RBD_CHILDREN, parent_spec, image_ids); -- 2.47.3