14f8ab
From 4a72ac20f728aa5c3141359ff89f1b61d4cd210a Mon Sep 17 00:00:00 2001
14f8ab
From: Mohammed Rafi KC <rkavunga@redhat.com>
14f8ab
Date: Fri, 17 May 2019 23:03:35 +0530
14f8ab
Subject: [PATCH 157/169] afr/frame: Destroy frame after
14f8ab
 afr_selfheal_entry_granular
14f8ab
14f8ab
In function "afr_selfheal_entry_granular", after completing the
14f8ab
heal we are not destroying the frame. This will lead to crash.
14f8ab
when we execute statedump operation, where it tried to access
14f8ab
xlator object. If this xlator object is freed as part of the
14f8ab
graph destroy this will lead to an invalid memory access
14f8ab
14f8ab
Upstream patch:https://review.gluster.org/22743
14f8ab
14f8ab
>Change-Id: I0a5e78e704ef257c3ac0087eab2c310e78fbe36d
14f8ab
>fixes: bz#1708926
14f8ab
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
14f8ab
14f8ab
Change-Id: I326354008e6d98376c8333d270f2f80036ad07f0
14f8ab
BUG: 1716626
14f8ab
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/172282
14f8ab
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
---
14f8ab
 xlators/cluster/afr/src/afr-self-heal-entry.c | 11 ++++++++---
14f8ab
 1 file changed, 8 insertions(+), 3 deletions(-)
14f8ab
14f8ab
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c
14f8ab
index fc09b4c..a6890fa 100644
14f8ab
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
14f8ab
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
14f8ab
@@ -832,6 +832,8 @@ afr_selfheal_entry_granular(call_frame_t *frame, xlator_t *this, fd_t *fd,
14f8ab
     subvol = priv->children[subvol_idx];
14f8ab
 
14f8ab
     args.frame = afr_copy_frame(frame);
14f8ab
+    if (!args.frame)
14f8ab
+        goto out;
14f8ab
     args.xl = this;
14f8ab
     /* args.heal_fd represents the fd associated with the original directory
14f8ab
      * on which entry heal is being attempted.
14f8ab
@@ -850,9 +852,10 @@ afr_selfheal_entry_granular(call_frame_t *frame, xlator_t *this, fd_t *fd,
14f8ab
          * do not treat heal as failure.
14f8ab
          */
14f8ab
         if (is_src)
14f8ab
-            return -errno;
14f8ab
+            ret = -errno;
14f8ab
         else
14f8ab
-            return 0;
14f8ab
+            ret = 0;
14f8ab
+        goto out;
14f8ab
     }
14f8ab
 
14f8ab
     ret = syncop_dir_scan(subvol, &loc, GF_CLIENT_PID_SELF_HEALD, &args,
14f8ab
@@ -862,7 +865,9 @@ afr_selfheal_entry_granular(call_frame_t *frame, xlator_t *this, fd_t *fd,
14f8ab
 
14f8ab
     if (args.mismatch == _gf_true)
14f8ab
         ret = -1;
14f8ab
-
14f8ab
+out:
14f8ab
+    if (args.frame)
14f8ab
+        AFR_STACK_DESTROY(args.frame);
14f8ab
     return ret;
14f8ab
 }
14f8ab
 
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab