summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-transport
diff options
context:
space:
mode:
authorHumble Devassy Chirammal <hchiramm@redhat.com>2015-03-05 17:28:08 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-03-09 03:23:55 -0700
commit854383198b6f02d85b4209a8e7dd7e7c0c118793 (patch)
treed52668931d097a9c56c41d0c55ae7c63a6097d3e /rpc/rpc-transport
parentb5e50cd714d105ff7aa1544182f07fb60320710d (diff)
rdma: 'list','wr' and 'new' memory has to be verified.
Change-Id: I29a8825107b8f4cefe4f4c59296e98fe675ee943 BUG: 1199053 Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> Reviewed-on: http://review.gluster.org/9811 Reviewed-by: mohammed rafi kc <rkavunga@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'rpc/rpc-transport')
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index 020974865dc..edfcb2a35e7 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -405,6 +405,11 @@ gf_rdma_register_arena (void **arg1, void *arg2)
for (i = 0; i < count; i++) {
new = GF_CALLOC(1, sizeof(gf_rdma_arena_mr),
gf_common_mt_rdma_arena_mr);
+ if (new == NULL) {
+ gf_log ("rdma", GF_LOG_INFO, "Out of memory:"
+ " registering pre allocated buffer wth rdma device failed.");
+ return -1;
+ }
INIT_LIST_HEAD (&new->list);
new->iobuf_arena = iobuf_arena;
@@ -446,6 +451,11 @@ gf_rdma_register_iobuf_pool (rpc_transport_t *this)
list_for_each_entry (tmp, &iobuf_pool->all_arenas, all_list) {
new = GF_CALLOC(1, sizeof(gf_rdma_arena_mr),
gf_common_mt_rdma_arena_mr);
+ if (new == NULL) {
+ gf_log ("rdma", GF_LOG_INFO, "Out of memory:"
+ " registering pre allocated buffer with rdma device failed.");
+ return -1;
+ }
INIT_LIST_HEAD (&new->list);
new->iobuf_arena = tmp;
@@ -3556,8 +3566,19 @@ gf_rdma_do_reads (gf_rdma_peer_t *peer, gf_rdma_post_t *post,
list = GF_CALLOC (post->ctx.gf_rdma_reads,
sizeof (struct ibv_sge), gf_common_mt_sge);
+
+ if (list == NULL) {
+ errno = ENOMEM;
+ ret = -1;
+ goto unlock;
+ }
wr = GF_CALLOC (post->ctx.gf_rdma_reads,
sizeof (struct ibv_send_wr), gf_common_mt_wr);
+ if (wr == NULL) {
+ errno = ENOMEM;
+ ret = -1;
+ goto unlock;
+ }
for (i = 0; readch[i].rc_discrim != 0; i++) {
count = post->ctx.count++;
post->ctx.vector[count].iov_base = ptr;
@@ -3604,7 +3625,7 @@ gf_rdma_do_reads (gf_rdma_peer_t *peer, gf_rdma_post_t *post,
if (!bad_wr) {
ret = -1;
- goto out;
+ goto unlock;
}
for (i = 0; i < post->ctx.gf_rdma_reads; i++) {