21ab4e
From 29e1b9171bfab7802d40268e75a2af6eeb186c97 Mon Sep 17 00:00:00 2001
21ab4e
From: Poornima G <pgurusid@redhat.com>
21ab4e
Date: Sun, 26 Mar 2017 07:59:53 +0530
21ab4e
Subject: [PATCH 371/375] protocol-client: Initialize the list_head before
21ab4e
 using
21ab4e
21ab4e
In client3_3_readdir(p)_cbk, in case of error conditions,
21ab4e
it is possible that the list_head is used before initializing.
21ab4e
Hence move the initialization before usage.
21ab4e
21ab4e
> Reviewed-on: https://review.gluster.org/16948
21ab4e
> Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
21ab4e
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
21ab4e
> Signed-off-by: Poornima G <pgurusid@redhat.com>
21ab4e
21ab4e
Change-Id: Ie58902d079fdc58416d17b5fa5f61375decb1c99
21ab4e
BUG: 1427096
21ab4e
Signed-off-by: Poornima G <pgurusid@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/102518
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 xlators/protocol/client/src/client-rpc-fops.c | 6 ++++--
21ab4e
 1 file changed, 4 insertions(+), 2 deletions(-)
21ab4e
21ab4e
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
21ab4e
index 2eda19c..116a11a 100644
21ab4e
--- a/xlators/protocol/client/src/client-rpc-fops.c
21ab4e
+++ b/xlators/protocol/client/src/client-rpc-fops.c
21ab4e
@@ -2559,6 +2559,8 @@ client3_3_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
21ab4e
         frame = myframe;
21ab4e
         local = frame->local;
21ab4e
 
21ab4e
+        INIT_LIST_HEAD (&entries.list);
21ab4e
+
21ab4e
         if (-1 == req->rpc_status) {
21ab4e
                 rsp.op_ret   = -1;
21ab4e
                 rsp.op_errno = ENOTCONN;
21ab4e
@@ -2574,7 +2576,6 @@ client3_3_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
21ab4e
                 goto out;
21ab4e
         }
21ab4e
 
21ab4e
-        INIT_LIST_HEAD (&entries.list);
21ab4e
         ret = client_post_readdir (this, &rsp, &entries, &xdata);
21ab4e
         if (ret < 0)
21ab4e
                 goto out;
21ab4e
@@ -2621,6 +2622,8 @@ client3_3_readdirp_cbk (struct rpc_req *req, struct iovec *iov, int count,
21ab4e
         frame = myframe;
21ab4e
         local = frame->local;
21ab4e
 
21ab4e
+        INIT_LIST_HEAD (&entries.list);
21ab4e
+
21ab4e
         if (-1 == req->rpc_status) {
21ab4e
                 rsp.op_ret   = -1;
21ab4e
                 rsp.op_errno = ENOTCONN;
21ab4e
@@ -2636,7 +2639,6 @@ client3_3_readdirp_cbk (struct rpc_req *req, struct iovec *iov, int count,
21ab4e
                 goto out;
21ab4e
         }
21ab4e
 
21ab4e
-        INIT_LIST_HEAD (&entries.list);
21ab4e
         ret = client_post_readdirp (this, &rsp, local->fd, &entries, &xdata);
21ab4e
         if (ret < 0)
21ab4e
                 goto out;
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e