]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Don't crash in get_hash_info() with a corrupt HashInfo
authorDavid Zafman <dzafman@redhat.com>
Wed, 14 Mar 2018 23:29:18 +0000 (16:29 -0700)
committerDavid Zafman <dzafman@redhat.com>
Wed, 11 Apr 2018 15:14:08 +0000 (08:14 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 0d4acc55ffd7f0f45324d1c933a2a5d0d47b84ec)

Conflicts:
src/osd/ECBackend.cc (Uses ::decode())

src/osd/ECBackend.cc

index e0cedf47db1a2877d0d18cce8028e0ffbf441089..3e6663630d13fff2a6418c34517f64284a884c60 100644 (file)
@@ -1737,7 +1737,12 @@ ECUtil::HashInfoRef ECBackend::get_hash_info(
       }
       if (bl.length() > 0) {
        bufferlist::iterator bp = bl.begin();
-       ::decode(hinfo, bp);
+        try {
+         ::decode(hinfo, bp);
+        } catch(...) {
+         dout(0) << __func__ << ": Can't decode hinfo for " << hoid << dendl;
+         return ECUtil::HashInfoRef();
+        }
        if (checks && hinfo.get_total_chunk_size() != (uint64_t)st.st_size) {
          dout(0) << __func__ << ": Mismatch of total_chunk_size "
                               << hinfo.get_total_chunk_size() << dendl;