diff options
author | Rahul C S <rahulcssjce@gmail.com> | 2011-09-20 17:44:07 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-09-22 02:35:21 -0700 |
commit | aa7815c29a849346a75389f6ad15d8190f5a6710 (patch) | |
tree | 457df4be2ff77551e8ccbc0e4bc114adacfdafa3 /xlators | |
parent | 8fc81caf43d491a49134e6491b813843e490bb99 (diff) |
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 <jenkins@build.gluster.com>
Reviewed-by: Shishir Gowda <shishirng@gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 97a2bd016..a6dc0b00b 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)) |