summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2017-03-26 07:59:53 +0530
committerRaghavendra G <rgowdapp@redhat.com>2017-03-26 20:56:19 -0400
commit98f602cd64e3f8cc7e4c4a7245e132c0afd7347f (patch)
tree408209c6dd82441f8ac06b89083952b62a322b98 /xlators/protocol
parent31377765dbbb8d49292c4362837a695adcbc6cb4 (diff)
protocol-client: Initialize the list_head before using
In client3_3_readdir(p)_cbk, in case of error conditions, it is possible that the list_head is used before initializing. Hence move the initialization before usage. Change-Id: Ie58902d079fdc58416d17b5fa5f61375decb1c99 BUG: 1435943 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: https://review.gluster.org/16948 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/protocol')
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index f70511709e1..58eb1c92311 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -2549,6 +2549,8 @@ client3_3_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
frame = myframe;
local = frame->local;
+ INIT_LIST_HEAD (&entries.list);
+
if (-1 == req->rpc_status) {
rsp.op_ret = -1;
rsp.op_errno = ENOTCONN;
@@ -2564,7 +2566,6 @@ client3_3_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
- INIT_LIST_HEAD (&entries.list);
ret = client_post_readdir (this, &rsp, &entries, &xdata);
if (ret < 0)
goto out;
@@ -2611,6 +2612,8 @@ client3_3_readdirp_cbk (struct rpc_req *req, struct iovec *iov, int count,
frame = myframe;
local = frame->local;
+ INIT_LIST_HEAD (&entries.list);
+
if (-1 == req->rpc_status) {
rsp.op_ret = -1;
rsp.op_errno = ENOTCONN;
@@ -2626,7 +2629,6 @@ client3_3_readdirp_cbk (struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
- INIT_LIST_HEAD (&entries.list);
ret = client_post_readdirp (this, &rsp, local->fd, &entries, &xdata);
if (ret < 0)
goto out;