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