17b94a
From 1aa175f353325775517daf1d48a19799e0cafc7a Mon Sep 17 00:00:00 2001
17b94a
From: Pranith Kumar K <pkarampu@redhat.com>
17b94a
Date: Mon, 22 Jul 2019 20:55:33 +0530
17b94a
Subject: [PATCH 261/261] features/utime: Fix mem_put crash
17b94a
17b94a
Problem:
17b94a
When frame->local is not null FRAME_DESTROY calls mem_put on it.
17b94a
Since the stub is already destroyed in call_resume(), it leads
17b94a
to crash
17b94a
17b94a
Fix:
17b94a
Set frame->local to NULL before calling call_resume()
17b94a
17b94a
Backport of:
17b94a
 > Patch: https://review.gluster.org/23091
17b94a
 > fixes: bz#1593542
17b94a
 > Change-Id: I0f8adf406f4cefdb89d7624ba7a9d9c2eedfb1de
17b94a
 > Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
17b94a
17b94a
BUG: 1715422
17b94a
Change-Id: I0f8adf406f4cefdb89d7624ba7a9d9c2eedfb1de
17b94a
Signed-off-by: Kotresh HR <khiremat@redhat.com>
17b94a
Reviewed-on: https://code.engineering.redhat.com/gerrit/176726
17b94a
Tested-by: RHGS Build Bot <nigelb@redhat.com>
17b94a
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
17b94a
---
17b94a
 xlators/features/utime/src/utime.c | 4 +++-
17b94a
 1 file changed, 3 insertions(+), 1 deletion(-)
17b94a
17b94a
diff --git a/xlators/features/utime/src/utime.c b/xlators/features/utime/src/utime.c
17b94a
index 2a986e7..e3a80b6 100644
17b94a
--- a/xlators/features/utime/src/utime.c
17b94a
+++ b/xlators/features/utime/src/utime.c
17b94a
@@ -139,12 +139,14 @@ gf_utime_set_mdata_setxattr_cbk(call_frame_t *frame, void *cookie,
17b94a
                                 xlator_t *this, int op_ret, int op_errno,
17b94a
                                 dict_t *xdata)
17b94a
 {
17b94a
+    call_stub_t *stub = frame->local;
17b94a
     /* Don't fail lookup if mdata setxattr fails */
17b94a
     if (op_ret) {
17b94a
         gf_msg(this->name, GF_LOG_ERROR, op_errno, UTIME_MSG_SET_MDATA_FAILED,
17b94a
                "dict set of key for set-ctime-mdata failed");
17b94a
     }
17b94a
-    call_resume(frame->local);
17b94a
+    frame->local = NULL;
17b94a
+    call_resume(stub);
17b94a
     return 0;
17b94a
 }
17b94a
 
17b94a
-- 
17b94a
1.8.3.1
17b94a