]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Fix a potential coredump when handling tx_buffers under heacy RDMA
authorownedu <yanlei_cv@aliyun.com>
Fri, 29 Sep 2017 05:50:23 +0000 (13:50 +0800)
committerownedu <yanlei_cv@aliyun.com>
Fri, 29 Sep 2017 05:50:23 +0000 (13:50 +0800)
traffic, there are chances to access a current_chunk which can be beyond the
range of pre-allocated Tx buffer pool thus causes a coredump.

Signed-off-by: Yan Lei <yongyou.yl@alibaba-inc.com>
src/msg/async/rdma/RDMAConnectedSocketImpl.cc

index 8f2ac4a59c147480a13555a08d79c075185f53de..32fadaed13fe756a9f5e257c6ecc118f6a6d339a 100644 (file)
@@ -467,9 +467,9 @@ ssize_t RDMAConnectedSocketImpl::submit(bool more)
         total_copied += r;
         bytes -= r;
         if (current_chunk->full()){
-          current_chunk = tx_buffers[++chunk_idx];
-          if (chunk_idx == tx_buffers.size())
+          if (++chunk_idx == tx_buffers.size())
             return total_copied;
+          current_chunk = tx_buffers[chunk_idx];
         }
       }
       ++start;