From af121942d7bdfc59fcfae0429ffb12993e7e019d 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 (cherry picked from commit 0d350b6817d7905908a4e432cd359ca1d36bab50) --- 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 afa466025327e..bf57f67a25eee 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -419,7 +419,12 @@ namespace librbd { for (std::list::const_iterator it = pools.begin(); it != pools.end(); ++it) { 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; int r = cls_client::get_children(&ioctx, RBD_CHILDREN, parent_spec, image_ids); -- 2.39.5