From 89a342ca6bfc1a014ff50cce5659abc58e11ecfc Mon Sep 17 00:00:00 2001 From: Mike Maslenkin Date: Sat, 28 Apr 2012 05:32:14 +0400 Subject: [PATCH] [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 Signed-off-by: James Bottomley --- drivers/scsi/scsi_transport_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index a2715c31e754..cf08071a9b6e 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -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; -- 2.20.1