From 91580140b3df01838c5c5a6dac301efb87c4bd93 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Tue, 12 Oct 2010 01:21:32 +0000 Subject: 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 Signed-off-by: Vijay Bellur BUG: 1756 (NFS must revalidate inode on first ESTALE on lookup) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1756 --- xlators/protocol/server/src/server3_1-fops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'xlators/protocol/server/src/server3_1-fops.c') 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; } } -- cgit