From: xie xingguo Date: Fri, 29 Jul 2016 03:09:00 +0000 (+0800) Subject: os/bluestore: fix potential access violation X-Git-Tag: ses5-milestone5~155^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d734dbaa5411d2ed63aa8889fefd3d761cad76ac;p=ceph.git os/bluestore: fix potential access violation According to BlueFS::_init_alloc(), if the relevant bdev does not exist, we will skip initializing the corresponding allocator too. So below here we shall check the existence of the specific allocator instead. Signed-off-by: xie xingguo --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index f8e3dc1d4429..8fe5e80463d1 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -144,7 +144,7 @@ void BlueFS::add_block_extent(unsigned id, uint64_t offset, uint64_t length) block_all[id].insert(offset, length); block_total[id] += length; - if (alloc.size()) { + if (id < alloc.size() && alloc[id]) { log_t.op_alloc_add(id, offset, length); int r = _flush_and_sync_log(l); assert(r == 0);