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