summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src/server3_1-fops.c
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2010-10-12 01:21:32 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-12 00:11:11 -0700
commit91580140b3df01838c5c5a6dac301efb87c4bd93 (patch)
treefd95562f4b85009e3140ae62b1220e51bc151e68 /xlators/protocol/server/src/server3_1-fops.c
parent2478d21c8d7c0e4d66990f7da7323f2c750a9d82 (diff)
protocol/server: be consistent in setting rsp.dict_len and rsp.dict
in cases where op_ret was -1 and dict was not NULL, the code was setting a dictionary length but not the serialized dictionary. This would cause crashes in the xdr serialization function Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1756 (NFS must revalidate inode on first ESTALE on lookup) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1756
Diffstat (limited to 'xlators/protocol/server/src/server3_1-fops.c')
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index 821729cc518..0c6db914062 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -88,7 +88,7 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
return 0;
}
- if (dict) {
+ if ((op_ret >= 0) && dict) {
rsp.dict.dict_len = dict_serialized_length (dict);
if (rsp.dict.dict_len < 0) {
gf_log (this->name, GF_LOG_ERROR,
@@ -98,10 +98,9 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
op_ret = -1;
op_errno = EINVAL;
rsp.dict.dict_len = 0;
+ goto out;
}
- }
- if ((op_ret >= 0) && dict) {
rsp.dict.dict_val = GF_CALLOC (1, rsp.dict.dict_len,
gf_server_mt_rsp_buf_t);
if (!rsp.dict.dict_val) {
@@ -118,6 +117,7 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
op_ret = -1;
op_errno = -ret;
rsp.dict.dict_len = 0;
+ goto out;
}
}