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