[ofa-general] [PATCH] Fix racy deadlock in cma

Roland Dreier rdreier at cisco.com
Wed Oct 3 12:20:41 PDT 2007


 > >    It seems rdma_destroy_id() has the same pattern, but it's not clear
 > >    to me in the code:
 > > 	mutex_lock(&lock);
 > > 	if (id_priv->cma_dev) {
 > > 		mutex_unlock(&lock);
 > > 		// why can't the device be hot-unplugged here??
 > 
 > The state of the id has been set to destroying, which will cause the
 > device removal code to ignore the id.  Even if device removal occurs
 > before the id state has been set, this should be safe.  A hot-plug
 > event reports the device removal, but waits for the user to destroy
 > the id. The device is only removed from the id by this function,
 > further down.

Got it -- you still have a cma-internal reference to the device, so
the hot-unplug won't complete, even though you drop the lock.

OK, looks fine to me.

 - R.



More information about the general mailing list