From aa7815c29a849346a75389f6ad15d8190f5a6710 Mon Sep 17 00:00:00 2001 From: Rahul C S Date: Tue, 20 Sep 2011 17:44:07 +0530 Subject: cluster/distribute: validate buf before accessing. The macro to check & reset rebalance flags was accessing the iatt structure even in case of failures leading to null dereference. Change-Id: I518f4cc9086cecbe6cf791c8a351287fe3613650 BUG: 3594 Reviewed-on: http://review.gluster.com/472 Tested-by: Gluster Build System Reviewed-by: Shishir Gowda --- xlators/cluster/dht/src/dht-common.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 97a2bd016a0..a6dc0b00bd7 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -254,11 +254,11 @@ typedef struct dht_disk_layout dht_disk_layout_t; ((buf)->ia_prot.sticky == 1) && \ ((buf)->ia_prot.sgid == 1)) -#define DHT_STRIP_PHASE1_FLAGS(buf) do { \ - if (IS_DHT_MIGRATION_PHASE1(buf)) { \ - (buf)->ia_prot.sticky = 0; \ - (buf)->ia_prot.sgid = 0; \ - } \ +#define DHT_STRIP_PHASE1_FLAGS(buf) do { \ + if ((buf) && IS_DHT_MIGRATION_PHASE1(buf)) { \ + (buf)->ia_prot.sticky = 0; \ + (buf)->ia_prot.sgid = 0; \ + } \ } while (0) #define check_is_dir(i,s,x) (IA_ISDIR(s->ia_type)) -- cgit