[SCSI] scsi_transport_spi: fix for unbalanced reference counting
authorMike Maslenkin <mihailm@parallels.com>
Sat, 28 Apr 2012 01:32:14 +0000 (05:32 +0400)
committerJames Bottomley <JBottomley@Parallels.com>
Thu, 10 May 2012 08:06:12 +0000 (09:06 +0100)
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>
drivers/scsi/scsi_transport_spi.c

index a2715c31e7545f1a3006c633e2a00312b1f2b46e..cf08071a9b6e33867fae59d47a3bc7fbd573ca7f 100644 (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;