]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: bail out if transaction size overflows
authorKefu Chai <kchai@redhat.com>
Wed, 17 Aug 2016 11:39:12 +0000 (19:39 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 19 Aug 2016 07:06:08 +0000 (15:06 +0800)
with a large MOSDMap message, the transaction size could be greater than
UINT_MAX. so fail early with error messages.

Fixes: http://tracker.ceph.com/issues/16982
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/osd/OSD.cc

index 6b0782621ffe75c6f79c6f6653b8968445dfb1eb..d017977e12b857dcfe850dd0a4aa34ce76743c6d 100644 (file)
@@ -6704,10 +6704,16 @@ void OSD::handle_osd_map(MOSDMap *m)
   }
 
   ObjectStore::Transaction t;
+  uint64_t txn_size = 0;
 
   // store new maps: queue for disk and put in the osdmap cache
   epoch_t start = MAX(superblock.newest_map + 1, first);
   for (epoch_t e = start; e <= last; e++) {
+    if (txn_size >= t.get_num_bytes()) {
+      derr << __func__ << " transaction size overflowed" << dendl;
+      assert(txn_size < t.get_num_bytes());
+    }
+    txn_size = t.get_num_bytes();
     map<epoch_t,bufferlist>::iterator p;
     p = m->maps.find(e);
     if (p != m->maps.end()) {