summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2018-07-24 13:56:56 +0530
committerAmar Tumballi <amarts@redhat.com>2018-09-05 09:23:53 +0000
commit35f86ce46240c4f9c216bbc29164ce441cfca1e7 (patch)
tree8d6bb3e4d68b02821dd039cfa00590ecb2ca812f
parent9ae986f18c0f251cba6bbc23eae2150a8ce0417e (diff)
protocol: don't use alloca
current implementation of alloca can cause issues when strings larger than the allocated buffer is passed to the xdr. Hence it makes sense to allow XDR decode functions to deal with memory allocations, which we can free later. Fixes: bz#1625097 Change-Id: I3a05553f5702de9575c244649ca0e5ac9abaac94 Signed-off-by: Amar Tumballi <amarts@redhat.com>
-rw-r--r--xlators/protocol/server/src/server-rpc-fops.c77
-rw-r--r--xlators/protocol/server/src/server-rpc-fops_v2.c84
2 files changed, 58 insertions, 103 deletions
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
index c5015befa7e..8efbb8dcb9e 100644
--- a/xlators/protocol/server/src/server-rpc-fops.c
+++ b/xlators/protocol/server/src/server-rpc-fops.c
@@ -3933,8 +3933,6 @@ server3_3_create (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_create_req, GF_FOP_CREATE);
if (ret != 0) {
@@ -3968,6 +3966,7 @@ server3_3_create (rpcsvc_request_t *req)
out:
/* memory allocated by libc, don't use GF_FREE */
free (args.xdata.xdata_val);
+ free (args.bname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4490,8 +4489,6 @@ server3_3_unlink (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_unlink_req, GF_FOP_UNLINK);
if (ret != 0) {
@@ -4516,6 +4513,7 @@ server3_3_unlink (rpcsvc_request_t *req)
resolve_and_resume (frame, server_unlink_resume);
out:
free (args.xdata.xdata_val);
+ free (args.bname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4537,8 +4535,6 @@ server3_3_setxattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.dict.dict_val = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_setxattr_req, GF_FOP_SETXATTR);
if (ret != 0) {
@@ -4574,6 +4570,7 @@ server3_3_setxattr (rpcsvc_request_t *req)
out:
free (args.xdata.xdata_val);
+ free (args.dict.dict_val);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4599,8 +4596,6 @@ server3_3_fsetxattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.dict.dict_val = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_fsetxattr_req, GF_FOP_FSETXATTR);
if (ret != 0) {
@@ -4634,6 +4629,7 @@ server3_3_fsetxattr (rpcsvc_request_t *req)
out:
free (args.xdata.xdata_val);
+ free (args.dict.dict_val);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4659,8 +4655,6 @@ server3_3_fxattrop (rpcsvc_request_t *req)
if (!req)
return ret;
- args.dict.dict_val = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_fxattrop_req, GF_FOP_FXATTROP);
if (ret != 0) {
@@ -4694,6 +4688,7 @@ server3_3_fxattrop (rpcsvc_request_t *req)
out:
free (args.xdata.xdata_val);
+ free (args.dict.dict_val);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4719,8 +4714,6 @@ server3_3_xattrop (rpcsvc_request_t *req)
if (!req)
return ret;
- args.dict.dict_val = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_xattrop_req, GF_FOP_XATTROP);
if (ret != 0) {
@@ -4753,6 +4746,7 @@ server3_3_xattrop (rpcsvc_request_t *req)
out:
free (args.xdata.xdata_val);
+ free (args.dict.dict_val);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4776,8 +4770,6 @@ server3_3_getxattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_getxattr_req, GF_FOP_GETXATTR);
if (ret != 0) {
@@ -4803,6 +4795,7 @@ server3_3_getxattr (rpcsvc_request_t *req)
resolve_and_resume (frame, server_getxattr_resume);
out:
free (args.xdata.xdata_val);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4823,8 +4816,6 @@ server3_3_fgetxattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_fgetxattr_req, GF_FOP_FGETXATTR);
if (ret != 0) {
@@ -4847,6 +4838,7 @@ server3_3_fgetxattr (rpcsvc_request_t *req)
resolve_and_resume (frame, server_fgetxattr_resume);
out:
free (args.xdata.xdata_val);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4868,8 +4860,6 @@ server3_3_removexattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_removexattr_req,
GF_FOP_REMOVEXATTR);
@@ -4891,6 +4881,7 @@ server3_3_removexattr (rpcsvc_request_t *req)
resolve_and_resume (frame, server_removexattr_resume);
out:
free (args.xdata.xdata_val);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4910,8 +4901,6 @@ server3_3_fremovexattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (4096);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_fremovexattr_req,
GF_FOP_FREMOVEXATTR);
@@ -4934,6 +4923,7 @@ server3_3_fremovexattr (rpcsvc_request_t *req)
resolve_and_resume (frame, server_fremovexattr_resume);
out:
free (args.xdata.xdata_val);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5144,8 +5134,6 @@ server3_3_mknod (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_mknod_req, GF_FOP_MKNOD);
if (ret != 0) {
@@ -5177,6 +5165,7 @@ out:
/* memory allocated by libc, don't use GF_FREE */
free (args.xdata.xdata_val);
+ free (args.bname);
return ret;
@@ -5195,8 +5184,6 @@ server3_3_mkdir (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_mkdir_req, GF_FOP_MKDIR);
if (ret != 0) {
@@ -5226,6 +5213,7 @@ out:
SERVER_REQ_SET_ERROR (req, ret);
free (args.xdata.xdata_val);
+ free (args.bname);
return ret;
}
@@ -5243,8 +5231,6 @@ server3_3_rmdir (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_rmdir_req, GF_FOP_RMDIR);
if (ret != 0) {
@@ -5268,6 +5254,7 @@ server3_3_rmdir (rpcsvc_request_t *req)
resolve_and_resume (frame, server_rmdir_resume);
out:
free (args.xdata.xdata_val);
+ free (args.bname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5290,8 +5277,6 @@ server3_3_inodelk (rpcsvc_request_t *req)
if (!req)
return ret;
- args.volume = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_inodelk_req, GF_FOP_INODELK);
if (ret != 0) {
@@ -5341,6 +5326,7 @@ server3_3_inodelk (rpcsvc_request_t *req)
resolve_and_resume (frame, server_inodelk_resume);
out:
free (args.xdata.xdata_val);
+ free (args.volume);
free (args.flock.lk_owner.lk_owner_val);
@@ -5362,8 +5348,6 @@ server3_3_finodelk (rpcsvc_request_t *req)
if (!req)
return ret;
- args.volume = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_finodelk_req,
GF_FOP_FINODELK);
@@ -5415,6 +5399,7 @@ server3_3_finodelk (rpcsvc_request_t *req)
resolve_and_resume (frame, server_finodelk_resume);
out:
free (args.xdata.xdata_val);
+ free (args.volume);
free (args.flock.lk_owner.lk_owner_val);
@@ -5437,9 +5422,6 @@ server3_3_entrylk (rpcsvc_request_t *req)
if (!req)
return ret;
- args.volume = alloca (256);
- args.name = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_entrylk_req,
GF_FOP_ENTRYLK);
@@ -5467,6 +5449,8 @@ server3_3_entrylk (rpcsvc_request_t *req)
resolve_and_resume (frame, server_entrylk_resume);
out:
free (args.xdata.xdata_val);
+ free (args.volume);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5486,9 +5470,6 @@ server3_3_fentrylk (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (256);
- args.volume = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_fentrylk_req,
GF_FOP_FENTRYLK);
@@ -5516,6 +5497,8 @@ server3_3_fentrylk (rpcsvc_request_t *req)
resolve_and_resume (frame, server_fentrylk_resume);
out:
free (args.xdata.xdata_val);
+ free (args.volume);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5576,9 +5559,6 @@ server3_3_symlink (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
- args.linkname = alloca (4096);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_symlink_req, GF_FOP_SYMLINK);
if (ret != 0) {
@@ -5607,6 +5587,8 @@ out:
/* memory allocated by libc, don't use GF_FREE */
free (args.xdata.xdata_val);
+ free (args.linkname);
+ free (args.bname);
return ret;
}
@@ -5625,8 +5607,6 @@ server3_3_link (rpcsvc_request_t *req)
if (!req)
return ret;
- args.newbname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_link_req, GF_FOP_LINK);
if (ret != 0) {
@@ -5651,6 +5631,7 @@ server3_3_link (rpcsvc_request_t *req)
resolve_and_resume (frame, server_link_resume);
out:
free (args.xdata.xdata_val);
+ free (args.newbname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5671,9 +5652,6 @@ server3_3_rename (rpcsvc_request_t *req)
if (!req)
return ret;
- args.oldbname = alloca (req->msg[0].iov_len);
- args.newbname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_rename_req, GF_FOP_RENAME);
if (ret != 0) {
@@ -5700,6 +5678,8 @@ server3_3_rename (rpcsvc_request_t *req)
resolve_and_resume (frame, server_rename_resume);
out:
free (args.xdata.xdata_val);
+ free (args.newbname);
+ free (args.oldbname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5902,9 +5882,6 @@ server3_3_lookup (rpcsvc_request_t *req)
GF_VALIDATE_OR_GOTO ("server", req, err);
- args.bname = alloca (req->msg[0].iov_len);
- args.xdata.xdata_val = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_lookup_req, GF_FOP_LOOKUP);
if (ret != 0) {
@@ -5931,8 +5908,14 @@ server3_3_lookup (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server_lookup_resume);
+ free (args.bname);
+ free (args.xdata.xdata_val);
+
return ret;
out:
+ free (args.bname);
+ free (args.xdata.xdata_val);
+
server_lookup_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL,
NULL, NULL);
ret = 0;
diff --git a/xlators/protocol/server/src/server-rpc-fops_v2.c b/xlators/protocol/server/src/server-rpc-fops_v2.c
index 64ca0bbf65b..92abaa1b5d1 100644
--- a/xlators/protocol/server/src/server-rpc-fops_v2.c
+++ b/xlators/protocol/server/src/server-rpc-fops_v2.c
@@ -3740,8 +3740,6 @@ server4_0_create (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_create_req, GF_FOP_CREATE);
if (ret != 0) {
@@ -3768,6 +3766,8 @@ server4_0_create (rpcsvc_request_t *req)
resolve_and_resume (frame, server4_create_resume);
out:
+ free (args.bname);
+
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4157,7 +4157,6 @@ server4_0_ftruncate (rpcsvc_request_t *req)
resolve_and_resume (frame, server4_ftruncate_resume);
out:
-
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4193,7 +4192,6 @@ server4_0_fstat (rpcsvc_request_t *req)
resolve_and_resume (frame, server4_fstat_resume);
out:
-
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4229,7 +4227,6 @@ server4_0_truncate (rpcsvc_request_t *req)
resolve_and_resume (frame, server4_truncate_resume);
out:
-
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4250,8 +4247,6 @@ server4_0_unlink (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_unlink_req, GF_FOP_UNLINK);
if (ret != 0) {
@@ -4271,7 +4266,7 @@ server4_0_unlink (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server4_unlink_resume);
out:
-
+ free (args.bname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4458,8 +4453,6 @@ server4_0_getxattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_getxattr_req, GF_FOP_GETXATTR);
if (ret != 0) {
@@ -4480,7 +4473,7 @@ server4_0_getxattr (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server4_getxattr_resume);
out:
-
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4501,8 +4494,6 @@ server4_0_fgetxattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_fgetxattr_req, GF_FOP_FGETXATTR);
if (ret != 0) {
@@ -4520,7 +4511,7 @@ server4_0_fgetxattr (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server4_fgetxattr_resume);
out:
-
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4542,8 +4533,6 @@ server4_0_removexattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_removexattr_req,
GF_FOP_REMOVEXATTR);
@@ -4560,7 +4549,7 @@ server4_0_removexattr (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server4_removexattr_resume);
out:
-
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4580,8 +4569,6 @@ server4_0_fremovexattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_fremovexattr_req,
GF_FOP_FREMOVEXATTR);
@@ -4599,7 +4586,7 @@ server4_0_fremovexattr (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server4_fremovexattr_resume);
out:
-
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4791,8 +4778,6 @@ server4_0_mknod (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_mknod_req, GF_FOP_MKNOD);
if (ret != 0) {
@@ -4815,6 +4800,8 @@ server4_0_mknod (rpcsvc_request_t *req)
resolve_and_resume (frame, server4_mknod_resume);
out:
+ free (args.bname);
+
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4835,8 +4822,6 @@ server4_0_mkdir (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_mkdir_req, GF_FOP_MKDIR);
if (ret != 0) {
@@ -4857,6 +4842,8 @@ server4_0_mkdir (rpcsvc_request_t *req)
resolve_and_resume (frame, server4_mkdir_resume);
out:
+ free (args.bname);
+
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4878,8 +4865,6 @@ server4_0_rmdir (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_rmdir_req, GF_FOP_RMDIR);
if (ret != 0) {
@@ -4898,7 +4883,7 @@ server4_0_rmdir (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server4_rmdir_resume);
out:
-
+ free (args.bname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4921,8 +4906,6 @@ server4_0_inodelk (rpcsvc_request_t *req)
if (!req)
return ret;
- args.volume = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_inodelk_req, GF_FOP_INODELK);
if (ret != 0) {
@@ -4967,7 +4950,7 @@ server4_0_inodelk (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server4_inodelk_resume);
out:
-
+ free (args.volume);
free (args.flock.lk_owner.lk_owner_val);
@@ -4989,8 +4972,6 @@ server4_0_finodelk (rpcsvc_request_t *req)
if (!req)
return ret;
- args.volume = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_finodelk_req,
GF_FOP_FINODELK);
@@ -5037,7 +5018,7 @@ server4_0_finodelk (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server4_finodelk_resume);
out:
-
+ free (args.volume);
free (args.flock.lk_owner.lk_owner_val);
@@ -5060,9 +5041,6 @@ server4_0_entrylk (rpcsvc_request_t *req)
if (!req)
return ret;
- args.volume = alloca (256);
- args.name = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_entrylk_req,
GF_FOP_ENTRYLK);
@@ -5085,7 +5063,8 @@ server4_0_entrylk (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server4_entrylk_resume);
out:
-
+ free (args.volume);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5105,9 +5084,6 @@ server4_0_fentrylk (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (256);
- args.volume = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_fentrylk_req,
GF_FOP_FENTRYLK);
@@ -5130,7 +5106,8 @@ server4_0_fentrylk (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server4_fentrylk_resume);
out:
-
+ free (args.volume);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5187,9 +5164,6 @@ server4_0_symlink (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
- args.linkname = alloca (4096);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_symlink_req, GF_FOP_SYMLINK);
if (ret != 0) {
@@ -5209,6 +5183,9 @@ server4_0_symlink (rpcsvc_request_t *req)
resolve_and_resume (frame, server4_symlink_resume);
out:
+ free (args.bname);
+ free (args.linkname);
+
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5228,8 +5205,6 @@ server4_0_link (rpcsvc_request_t *req)
if (!req)
return ret;
- args.newbname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_link_req, GF_FOP_LINK);
if (ret != 0) {
@@ -5249,7 +5224,7 @@ server4_0_link (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server4_link_resume);
out:
-
+ free (args.newbname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5270,9 +5245,6 @@ server4_0_rename (rpcsvc_request_t *req)
if (!req)
return ret;
- args.oldbname = alloca (req->msg[0].iov_len);
- args.newbname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_rename_req, GF_FOP_RENAME);
if (ret != 0) {
@@ -5294,7 +5266,8 @@ server4_0_rename (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server4_rename_resume);
out:
-
+ free (args.oldbname);
+ free (args.newbname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5447,8 +5420,6 @@ server4_0_lookup (rpcsvc_request_t *req)
GF_VALIDATE_OR_GOTO ("server", req, err);
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfx_lookup_req, GF_FOP_LOOKUP);
if (ret != 0) {
@@ -5472,6 +5443,8 @@ server4_0_lookup (rpcsvc_request_t *req)
resolve_and_resume (frame, server4_lookup_resume);
err:
+ free (args.bname);
+
return ret;
}
@@ -5502,7 +5475,6 @@ server4_0_statfs (rpcsvc_request_t *req)
resolve_and_resume (frame, server4_statfs_resume);
out:
-
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5749,8 +5721,6 @@ server4_0_put (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, &len, &args,
xdr_gfx_put_req, GF_FOP_PUT);
if (ret != 0) {
@@ -5798,6 +5768,8 @@ server4_0_put (rpcsvc_request_t *req)
resolve_and_resume (frame, server4_put_resume);
out:
+ free (args.bname);
+
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);