[SCSI] scsi_transport_spi: fix for unbalanced reference counting

Check the domain validation flag on the given device before referencing
scsi_device instance, otherwise if the flag is already set we return without
decrementing the reference count.

Signed-off-by: Mike Maslenkin <mihailm@parallels.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
Mike Maslenkin 2012-04-28 05:32:14 +04:00 committed by James Bottomley
parent 9ebd99c599
commit 89a342ca6b
1 changed files with 2 additions and 2 deletions

View File

@ -1010,10 +1010,10 @@ spi_dv_device(struct scsi_device *sdev)
u8 *buffer;
const int len = SPI_MAX_ECHO_BUFFER_SIZE*2;
if (unlikely(scsi_device_get(sdev)))
if (unlikely(spi_dv_in_progress(starget)))
return;
if (unlikely(spi_dv_in_progress(starget)))
if (unlikely(scsi_device_get(sdev)))
return;
spi_dv_in_progress(starget) = 1;