diff options
author | Poornima G <pgurusid@redhat.com> | 2017-03-26 07:59:53 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-03-27 10:59:42 -0400 |
commit | bbe96394337446364af235cf40293bf596072ace (patch) | |
tree | d5bc6239626df6d550c6924f2f1f294ba95af679 | |
parent | 8ab106ab27c427acda2a040d9f81cb8b7d573921 (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.
>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>
Change-Id: Ie58902d079fdc58416d17b5fa5f61375decb1c99
BUG: 1435946
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: https://review.gluster.org/16949
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
-rw-r--r-- | xlators/protocol/client/src/client-rpc-fops.c | 6 |
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 37d119fc08c..ad6baaf7473 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; |