Blob Blame History Raw
From b0f153893c9fd4328d51e32be4ecf8d75d5968d5 Mon Sep 17 00:00:00 2001
From: Mohammed Rafi KC <rkavunga@redhat.com>
Date: Fri, 17 May 2019 12:49:59 +0530
Subject: [PATCH 540/540] dht: NULL check before setting error flag

Function dht_common_mark_mdsxattr blindly setting value for
an integer pointer without validating it. In fact there are
two callers of this function that passes NULL value to the
same pointer which leads to a crash.

Backport of : https://review.gluster.org/#/c/22345/

>Change-Id: Id94ffe216f6a21f007b3291bff0b1e1c1989075c
>fixes: bz#1687811
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>

Change-Id: I3efb227619bef5f69570763848e09b2784371140
BUG: 1711159
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/170622
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 xlators/cluster/dht/src/dht-common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 12a17e6..e998417 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -890,7 +890,8 @@ dht_common_mark_mdsxattr (call_frame_t *frame, int *errst, int mark_during_fresh
                                 "Failed to get hashed subvol for path %s"
                                 "gfid is %s ",
                                 local->loc.path, gfid_local);
-                        (*errst) = 1;
+                        if (errst)
+                                (*errst) = 1;
                         ret = -1;
                         goto out;
                 }
-- 
1.8.3.1