CAM - Fix missing SIM lock in cam_periph_release()
commit851c57bb2d6b6b44dd70627c4ea8a798d32d80f3
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 30 Sep 2009 22:26:05 +0000 (30 15:26 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 30 Sep 2009 22:32:53 +0000 (30 15:32 -0700)
tree7c8cacf4cefe84ac92d9e70d1968075d31afbff2
parent12e8c5837f747b0a8f7f8c3cd0d1317467cb1a4b
CAM - Fix missing SIM lock in cam_periph_release()

* When releasing the last reference on a CAM peripheral which has been
  marked invalid, the peripheral is then freed.  Freeing the peripheral
  requires the SIM lock.

  Go through necessary tribulations to acquire the SIM lock.  The lock order
  is important (SIM lock first, XPT lock second), and the SIM lock may or
  may not already be held by the thread.

* The bug could cause a crash after burning a CD as the CD becomes invalid
  after the burn completes in order to reload its state.
sys/bus/cam/cam_periph.c
sys/bus/cam/cam_sim.c
sys/bus/cam/cam_sim.h