Windows: Hold ProcessTreeLock across AFSValidateProcessEntry
authorJeffrey Altman <jaltman@your-file-system.com>
Wed, 14 Nov 2012 12:02:01 +0000 (07:02 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 15 Nov 2012 16:45:43 +0000 (08:45 -0800)
commite1d149c925cfcc2656086bee2416fb319e1bd9ca
tree70c1a5c8b527257e3adcf2219fc2a9b07a4bb6d5
parentf56c01d313140b625b4342feddfe464342d1ced4
Windows: Hold ProcessTreeLock across AFSValidateProcessEntry

AFSValidateProcessEntry() is called from AFSProcessCreate() which
holds the ProcessTree.TreeLock exclusive across the call and from
AFSCreate() and AFSRetrieveAuthGroup() where it is not held at all.

Add a parameter to AFSValidateProcessEntry() that indicates whether
or not the ProcessTree.TreeLock is held.  If it is held, it must be
held exclusive.  If it is not held, the lock must be acquired within
AFSValidateProcessEntry() and it must be held for the entire lifetime
of the pParentProcessCB reference.  Failure to hold the TreeLock
for the lifetime of the reference permits a race with AFSProcessDestroy()
that can result in the parent ProcessCB being destroyed while its
Resource is held.

Change-Id: I7cf0dff6bd541b0588a060d677a8e3d724858b96
Reviewed-on: http://gerrit.openafs.org/8455
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
src/WINNT/afsrdr/kernel/fs/AFSAuthGroupSupport.cpp
src/WINNT/afsrdr/kernel/fs/AFSCreate.cpp
src/WINNT/afsrdr/kernel/fs/AFSProcessSupport.cpp
src/WINNT/afsrdr/kernel/fs/Include/AFSCommon.h