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