diff options
author | Harshavardhana <harsha@harshavardhana.net> | 2014-08-21 22:22:37 -0700 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2014-08-22 00:28:59 -0700 |
commit | 60f12dfbc87818831a65ac80ad8ba2fe166a29e2 (patch) | |
tree | 5081e7d33308cbeedc0ea934d1a960d5e4327d62 /xlators/protocol | |
parent | aa9b19e4b3329f446f0eb9b3a4ed0dbb9ebe4d09 (diff) |
client: client3_3_readdir() - initialize ``local`` properly
A crash is observed in the following scenario on OSX
~~~
(gdb) p readdir_rsp_size
$1 = 1552
GLUSTERFS_RPC_REPLY_SIZE == 24
GLUSTERFS_RDMA_MAX_HEADER_SIZE == 228
((1552 + 24 + 228)) == 1804
GLUSTERFS_RDMA_INLINE_THRESHOLD == 2048
if ((readdir_rsp_size +
GLUSTERFS_RPC_REPLY_SIZE +
GLUSTERFS_RDMA_MAX_HEADER_SIZE) > GLUSTERFS_RDMA_INLINE_THRESHOLD)
----> False
~~~
``local`` is never initialized leads to NULL reference later.
This patch makes sure that local is initialized, correctly as its
done in client3_3_readdirp() call.
Change-Id: I46931fc96900b7740ae71536c954bb9deda5c879
BUG: 1132796
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/8511
Reviewed-by: Niels de Vos <ndevos@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 'xlators/protocol')
-rw-r--r-- | xlators/protocol/client/src/client-rpc-fops.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c index 50ade5dc442..3bfa03fa2ed 100644 --- a/xlators/protocol/client/src/client-rpc-fops.c +++ b/xlators/protocol/client/src/client-rpc-fops.c @@ -5661,15 +5661,15 @@ client3_3_readdir (call_frame_t *frame, xlator_t *this, readdir_rsp_size = xdr_sizeof ((xdrproc_t) xdr_gfs3_readdir_rsp, &rsp) + args->size; + local = mem_get0 (this->local_pool); + if (!local) { + op_errno = ENOMEM; + goto unwind; + } + frame->local = local; + if ((readdir_rsp_size + GLUSTERFS_RPC_REPLY_SIZE + GLUSTERFS_RDMA_MAX_HEADER_SIZE) > (GLUSTERFS_RDMA_INLINE_THRESHOLD)) { - local = mem_get0 (this->local_pool); - if (!local) { - op_errno = ENOMEM; - goto unwind; - } - frame->local = local; - rsp_iobref = iobref_new (); if (rsp_iobref == NULL) { goto unwind; |