CAM - Fix missing SIM lock in cam_periph_release()
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 30 Sep 2009 22:26:05 +0000 (15:26 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 30 Sep 2009 22:26:05 +0000 (15:26 -0700)
commitf627566b0930dac0199460857380c4ec422a05bf
tree6dd0c09badfcd2043954ea6afac08ab49e561c21
parentdc2cbe9dd5787f91a60cd304c11abdb6cc134918
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