From 217e7d6889220ac14d00987ac97944b5890b2df8 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 7 Mar 2008 17:46:00 +0000 Subject: [PATCH] DEVEL15-windows-scache-verification-20080307 LICENSE MIT Add a hash value verification check for stat cache entries (cherry picked from commit 45200a26985678ccad051385f50f94321eb98256) --- src/WINNT/afsd/cm_scache.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/WINNT/afsd/cm_scache.c b/src/WINNT/afsd/cm_scache.c index 41271a9378..c36484af3b 100644 --- a/src/WINNT/afsd/cm_scache.c +++ b/src/WINNT/afsd/cm_scache.c @@ -463,6 +463,8 @@ cm_ValidateSCache(void) for ( i=0; i < cm_data.scacheHashTableSize; i++ ) { for ( scp = cm_data.scacheHashTablep[i]; scp; scp = scp->nextp ) { + afs_uint32 hash; + hash = CM_SCACHE_HASH(&scp->fid); if (scp->magic != CM_SCACHE_MAGIC) { afsi_log("cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC"); fprintf(stderr, "cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC\n"); @@ -483,6 +485,11 @@ cm_ValidateSCache(void) fprintf(stderr, "cm_ValidateSCache failure: scp->volp->magic != CM_VOLUME_MAGIC\n"); return -12; } + if (hash != i) { + afsi_log("cm_ValidateSCache failure: scp hash != hash index"); + fprintf(stderr, "cm_ValidateSCache failure: scp hash != hash index\n"); + return -13; + } } }