msg/async/rdma: limit buffer size under rdma max memory region size

The allocated buf size should be under hardware's max_mr_size. Or it'll
trigger out-of-bound access problem when calling ibv_reg_mr.

Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
This commit is contained in:
Changcheng Liu 2019-06-13 18:20:39 +08:00
parent 9c7ba67cc7
commit 4f5a31ab9d

View File

@ -785,7 +785,8 @@ Infiniband::MemoryManager::MemoryManager(CephContext *c, Device *d, ProtectionDo
(c->_conf->ms_async_rdma_receive_buffers < 2 * c->_conf->ms_async_rdma_receive_queue_len ?
c->_conf->ms_async_rdma_receive_buffers : 2 * c->_conf->ms_async_rdma_receive_queue_len) :
// rx pool is infinite, we can set any initial size that we want
2 * c->_conf->ms_async_rdma_receive_queue_len)
2 * c->_conf->ms_async_rdma_receive_queue_len,
device->device_attr.max_mr_size / (sizeof(Chunk) + cct->_conf->ms_async_rdma_buffer_size))
{
}