From: Jason Dillaman Date: Tue, 18 Nov 2014 02:49:26 +0000 (-0500) Subject: librbd: protect list_children from invalid child pool IoCtxs X-Git-Tag: v0.87.1~54^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F3062%2Fhead;p=ceph.git 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) --- diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 8b4ea9e10ec..3b7bdfc739c 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);