]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-windows-scache-verification-20080307
authorJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 7 Mar 2008 17:46:00 +0000 (17:46 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 7 Mar 2008 17:46:00 +0000 (17:46 +0000)
LICENSE MIT

Add a hash value verification check for stat cache entries

(cherry picked from commit 45200a26985678ccad051385f50f94321eb98256)

src/WINNT/afsd/cm_scache.c

index 41271a937811e6188c8b696bd705f912176d3ab7..c36484af3bb856562b4767a323c0e3588edf5532 100644 (file)
@@ -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;
+            }
         }
     }