SCSI: sd: revive sd_index_lock
commit4a61d3855a95e6e513be5bdfed536d071b853904
authorTejun Heo <tj@kernel.org>
Sat, 21 Feb 2009 02:04:45 +0000 (21 11:04 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Mar 2009 00:52:47 +0000 (16 17:52 -0700)
treedd358b3e2bfa7a1b062e4746eb7ab4c4be252bd5
parent8d9799ed7a1c0d64c693aacba29fda4bce14102f
SCSI: sd: revive sd_index_lock

commit 4034cc68157bfa0b6622efe368488d3d3e20f4e6 upstream.

Commit f27bac2761cab5a2e212dea602d22457a9aa6943 which converted sd to
use ida instead of idr incorrectly removed sd_index_lock around id
allocation and free.  idr/ida do have internal locks but they protect
their free object lists not the allocation itself.  The caller is
responsible for that.  This missing synchronization led to the same id
being assigned to multiple devices leading to oops.

Reported and tracked down by Stuart Hayes of Dell.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/scsi/sd.c