Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Mike Maslenkin and committed by
James Bottomley
89a342ca 9ebd99c5

+2 -2
+2 -2
drivers/scsi/scsi_transport_spi.c
··· 1010 1010 u8 *buffer; 1011 1011 const int len = SPI_MAX_ECHO_BUFFER_SIZE*2; 1012 1012 1013 - if (unlikely(scsi_device_get(sdev))) 1013 + if (unlikely(spi_dv_in_progress(starget))) 1014 1014 return; 1015 1015 1016 - if (unlikely(spi_dv_in_progress(starget))) 1016 + if (unlikely(scsi_device_get(sdev))) 1017 1017 return; 1018 1018 spi_dv_in_progress(starget) = 1; 1019 1019