From: Jeffrey Altman Date: Sun, 18 Nov 2012 02:44:52 +0000 (-0500) Subject: Windows: buf_CleanLocked protect against NULL bp->userp X-Git-Tag: upstream/1.8.0_pre1^2~1798 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=f436fe03c80e21b6a58a6de962070841e00791ef;p=packages%2Fo%2Fopenafs.git Windows: buf_CleanLocked protect against NULL bp->userp The cm_buf_t.userp field should never be NULL if the CM_BUF_DIRTY flag is set but apparently it sometimes is. cm_BufWrite() requires that the userp parameter be non-NULL. Otherwise, an assertion fails and afsd_service.exe panics. If bp->userp is NULL, use cm_rootUserp. The worst that will happen is the write will fail due to an access denied error. Change-Id: I6cc650dcffe2b0fb50ac2ce91b74e8afbdfc40ca Reviewed-on: http://gerrit.openafs.org/8475 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/afsd/cm_buf.c b/src/WINNT/afsd/cm_buf.c index bed02b045..04573d055 100644 --- a/src/WINNT/afsd/cm_buf.c +++ b/src/WINNT/afsd/cm_buf.c @@ -860,9 +860,8 @@ afs_uint32 buf_CleanLocked(cm_scache_t *scp, cm_buf_t *bp, cm_req_t *reqp, * to determine if it is appropriate to fill a full chunk of data * when storing to the file server. */ - code = (*cm_buf_opsp->Writep)(scp, &offset, - bp->dirty_length, - flags, bp->userp, reqp); + code = (*cm_buf_opsp->Writep)(scp, &offset, bp->dirty_length, flags, + bp->userp ? bp->userp : cm_rootUserp, reqp); osi_Log3(buf_logp, "buf_CleanLocked I/O on scp 0x%p buf 0x%p, done=%d", scp, bp, code); } lock_ObtainMutex(&bp->mx);