From bcdb77023e2efbbf06ad576851f0f38a0b8b11ab Mon Sep 17 00:00:00 2001 From: Susant Palai Date: Tue, 18 Jun 2019 16:43:43 +0530 Subject: posix: fix crash in posix_cs_set_state Fixes: bz#1721474 Change-Id: Ic2a53fa3d1e9e23424c6898e0986f80d52c5e3f6 Signed-off-by: Susant Palai --- xlators/storage/posix/src/posix-helpers.c | 5 +++++ xlators/storage/posix/src/posix-inode-fd-ops.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'xlators/storage') diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 686b0becbc2..a0c273fa772 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -3246,6 +3246,11 @@ posix_cs_set_state(xlator_t *this, dict_t **rsp, gf_cs_obj_state state, char *value = NULL; size_t xattrsize = 0; + if (!rsp) { + ret = -1; + goto out; + } + if (!(*rsp)) { *rsp = dict_new(); if (!(*rsp)) { diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c index e3b2692ad9c..4311478766c 100644 --- a/xlators/storage/posix/src/posix-inode-fd-ops.c +++ b/xlators/storage/posix/src/posix-inode-fd-ops.c @@ -1027,6 +1027,7 @@ posix_glfallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt statpost = { 0, }; + dict_t *rsp_xdata = NULL; #ifdef FALLOC_FL_KEEP_SIZE if (keep_size) @@ -1034,15 +1035,15 @@ posix_glfallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, #endif /* FALLOC_FL_KEEP_SIZE */ ret = posix_do_fallocate(frame, this, fd, flags, offset, len, &statpre, - &statpost, xdata, NULL); + &statpost, xdata, &rsp_xdata); if (ret < 0) goto err; - STACK_UNWIND_STRICT(fallocate, frame, 0, 0, &statpre, &statpost, NULL); + STACK_UNWIND_STRICT(fallocate, frame, 0, 0, &statpre, &statpost, rsp_xdata); return 0; err: - STACK_UNWIND_STRICT(fallocate, frame, -1, -ret, NULL, NULL, NULL); + STACK_UNWIND_STRICT(fallocate, frame, -1, -ret, NULL, NULL, rsp_xdata); return 0; } -- cgit