From 3dc629822adeee961d78208b46b9bd7ef1200890 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 8b4ea9e10ec80..3b7bdfc739c7a 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