]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/bit_vector: utilize deep-copy during data decode 15017/head
authorJason Dillaman <dillaman@redhat.com>
Tue, 9 May 2017 15:31:52 +0000 (11:31 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 9 May 2017 15:31:52 +0000 (11:31 -0400)
BlueStore utilizes an in-memory cache of bufferlists. If the bit vector
directly manipulates the shallow-copied bufferlist, it can corrupt
the CRC.

Fixes: http://tracker.ceph.com/issues/19863
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/common/bit_vector.hpp

index 62d924d984f2d17455e39d0ef478d00fb2fafc3e..c15b0927e376c5614b9c0f54d1b74dae27435e16 100644 (file)
@@ -231,8 +231,11 @@ void BitVector<_b>::decode_data(bufferlist::iterator& it, uint64_t byte_offset)
   while (byte_offset < end_offset) {
     uint64_t len = MIN(BLOCK_SIZE, end_offset - byte_offset);
 
+    bufferptr ptr;
+    it.copy_deep(len, ptr);
+
     bufferlist bit;
-    it.copy(len, bit);
+    bit.append(ptr);
     if (m_crc_enabled &&
        m_data_crcs[byte_offset / BLOCK_SIZE] != bit.crc32c(0)) {
       throw buffer::malformed_input("invalid data block CRC");