From cf57eb294f28084cbb138b1a06bc813e14e6d0ec Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 14 Sep 2011 17:46:32 -0400 Subject: [PATCH] Windows: validate buffer hash tables in cm_MergeStatus Change-Id: I1ff76513e9f2ba08bdeb988a19fec992b08310db Reviewed-on: http://gerrit.openafs.org/5425 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_buf.c | 2 +- src/WINNT/afsd/cm_scache.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/WINNT/afsd/cm_buf.c b/src/WINNT/afsd/cm_buf.c index 483c0c2f17..73d64f8e5f 100644 --- a/src/WINNT/afsd/cm_buf.c +++ b/src/WINNT/afsd/cm_buf.c @@ -888,7 +888,7 @@ void buf_Recycle(cm_buf_t *bp) i = BUF_HASH(&bp->fid, &bp->offset); lbpp = &(cm_data.buf_scacheHashTablepp[i]); - for(tbp = *lbpp; tbp; lbpp = &tbp->hashp, tbp = *lbpp) { + for(tbp = *lbpp; tbp; lbpp = &tbp->hashp, tbp = tbp->hashp) { if (tbp == bp) break; } diff --git a/src/WINNT/afsd/cm_scache.c b/src/WINNT/afsd/cm_scache.c index db24b4fe34..687b0cdfe4 100644 --- a/src/WINNT/afsd/cm_scache.c +++ b/src/WINNT/afsd/cm_scache.c @@ -1646,11 +1646,14 @@ void cm_MergeStatus(cm_scache_t *dscp, j = BUF_HASH(&bp->fid, &bp->offset); lbpp = &(cm_data.buf_scacheHashTablepp[j]); - for(tbp = *lbpp; tbp; lbpp = &tbp->hashp, tbp = *lbpp) { + for(tbp = *lbpp; tbp; lbpp = &tbp->hashp, tbp = tbp->hashp) { if (tbp == bp) break; } + /* we better find it */ + osi_assertx(tbp != NULL, "cm_MergeStatus: buf_scacheHashTablepp table screwup"); + *lbpp = bp->hashp; /* hash out */ bp->hashp = NULL;