]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: get_parent_info should protect against invalid parent
authorJason Dillaman <dillaman@redhat.com>
Mon, 16 Mar 2015 22:35:07 +0000 (18:35 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 1 Apr 2015 19:54:51 +0000 (15:54 -0400)
get_parent_info should return -ENOENT if the image does not
have an associated parent image.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 21afd0ef8e1fb81c5ace5fd403513c542e2413e3)

src/librbd/internal.cc

index 8f5f040f52a9940098ac6e355f2c123f20509a87..2651ba6208f873702d3240c91c72e4b3bc932b21 100644 (file)
@@ -1426,6 +1426,9 @@ reprotect_and_return_err:
 
     RWLock::RLocker l(ictx->snap_lock);
     RWLock::RLocker l2(ictx->parent_lock);
+    if (ictx->parent == NULL) {
+      return -ENOENT;
+    }
 
     parent_spec parent_spec;