]> git.karo-electronics.de Git - karo-tx-linux.git/commit
SCSI: dual scan thread bug fix
authorJames Bottomley <JBottomley@Parallels.com>
Tue, 21 Jan 2014 15:01:41 +0000 (07:01 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 May 2014 20:20:27 +0000 (13:20 -0700)
commit50b9f5b92eeee5b1ec5495d0ba1645f900855a1b
tree85f1feb189ff0d7c09a42c99e4f30acdff13f63a
parentbf1802de75b7e3aab950efde9efb61637e4f449f
SCSI: dual scan thread bug fix

commit f2495e228fce9f9cec84367547813cbb0d6db15a upstream.

In the highly unusual case where two threads are running concurrently through
the scanning code scanning the same target, we run into the situation where
one may allocate the target while the other is still using it.  In this case,
because the reap checks for STARGET_CREATED and kills the target without
reference counting, the second thread will do the wrong thing on reap.

Fix this by reference counting even creates and doing the STARGET_CREATED
check in the final put.

Tested-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/scsi_scan.c