]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: protect list_children from invalid child pool IoCtxs 3063/head
authorJason Dillaman <dillaman@redhat.com>
Tue, 18 Nov 2014 02:49:26 +0000 (21:49 -0500)
committerJason Dillaman <dillaman@redhat.com>
Tue, 2 Dec 2014 07:34:31 +0000 (02:34 -0500)
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 <dillaman@redhat.com>
(cherry picked from commit 0d350b6817d7905908a4e432cd359ca1d36bab50)

src/librbd/internal.cc

index afa466025327e154be8816f156dbeb47a8ee0130..bf57f67a25eee4a39178178fa96ae9437056e73f 100644 (file)
@@ -419,7 +419,12 @@ namespace librbd {
     for (std::list<string>::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<string> image_ids;
       int r = cls_client::get_children(&ioctx, RBD_CHILDREN,
                                       parent_spec, image_ids);