winverbs: fix race in async connect handling
If an application calls Connect or Accept, their IRP is queued to a
work queue for asynchronous processing. However, if the application
crashes or exits before the work queue can process the IRP, the cleanup
code will call WvEpFree(). This destroys the IbCmId.
When the work queue finally runs, it can access a freed IbCmId.
This is bad. A similar race exists with the QP and the asynchronous
disconnect processing. The disconnect processing can access a
the hVerbsQp handle after it has been destroyed.
Additionally, in all three cases, the IRPs assume that the WV provider
is able to process IRPs. Specifically, they require that the index
tables maintained by the provider are still valid. References must
be held on the WV provider until the IRPs finish their processing to
ensure this.
Fix invalid accesses to the IbCmId and hVerbsQp handles by locking
around their use after valid state checks. In the case of the QP, we
add a guarded mutex for synchronization purposes and use that in place
where the PD mutex had been used.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2410
ad392aa1-c5ef-ae45-8dd8-
e69d62a5ef86