summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Dillaman <dillaman@redhat.com>2015-03-16 18:35:07 -0400
committerJason Dillaman <dillaman@redhat.com>2015-04-01 15:54:51 -0400
commit572a2f5707f91f11c3ccaeca3ae88d8914d3dbc2 (patch)
treec5df5cb2fb533179988d7dd0fdea5ca2f0955ae2
parent28787d2184754a2988a26abb23eb3fa91d1d46fd (diff)
downloadceph-572a2f5707f91f11c3ccaeca3ae88d8914d3dbc2.tar.gz
librbd: get_parent_info should protect against invalid parent
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)
-rw-r--r--src/librbd/internal.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc
index 8f5f040f52a..2651ba6208f 100644
--- a/src/librbd/internal.cc
+++ b/src/librbd/internal.cc
@@ -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;