Skip to content

Commit

Permalink
osd: bail out if transaction size overflows
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
tchaikov committed Aug 17, 2016
1 parent 80d914f commit dd2f9f4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/osd/OSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit dd2f9f4

Please sign in to comment.