Blob Blame History Raw
From 1c1cb9523eeda869c1589ef27005f4a99bda2a02 Mon Sep 17 00:00:00 2001
From: Mohammed Rafi KC <rkavunga@redhat.com>
Date: Fri, 4 Sep 2015 19:46:48 +0530
Subject: [PATCH 324/330] dht: NULL dereferencing causes crash

    back port of : http://review.gluster.org/12106

If linkfile_create is failed for some reason, then
we are trying to dereference a null variable

>Change-Id: I3c6ff3715821b9b993d1bab7b90167de2861e190
>BUG: 1260147
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
>Reviewed-on: http://review.gluster.org/12106
>Reviewed-by: Susant Palai <spalai@redhat.com>
>Reviewed-by: N Balachandran <nbalacha@redhat.com>
>Tested-by: Gluster Build System <jenkins@build.gluster.com>
>Reviewed-by: Raghavendra G <rgowdapp@redhat.com>

Change-Id: I95d5b58ecf46a6f6dded127267061f671e0055e6
BUG: 1260512
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/57364
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
Reviewed-by: Susant Palai <spalai@redhat.com>
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
---
 xlators/cluster/dht/src/dht-common.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 5c1a693..e3fe7dd 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -5025,10 +5025,10 @@ dht_mknod_linkfile_create_cbk (call_frame_t *frame, void *cookie,
         dht_local_t  *local = NULL;
         xlator_t     *cached_subvol = NULL;
 
+        local = frame->local;
         if (op_ret == -1)
                 goto err;
 
-        local = frame->local;
         if (!local || !local->cached_subvol) {
                 op_errno = EINVAL;
                 goto err;
@@ -5822,12 +5822,12 @@ dht_create_linkfile_create_cbk (call_frame_t *frame, void *cookie,
         dht_local_t  *local = NULL;
         xlator_t     *cached_subvol = NULL;
 
+        local = frame->local;
         if (op_ret == -1) {
                 local->op_errno = op_errno;
                 goto err;
         }
 
-        local = frame->local;
         cached_subvol = local->cached_subvol;
 
         STACK_WIND (frame, dht_create_cbk,
-- 
1.7.1