Skip to content

Commit

Permalink
[SCSI] scsi_transport_spi: fix oops in revalidate
Browse files Browse the repository at this point in the history
The class_device->device conversion is causing an oops in revalidate
because it's assuming that the device_for_each_child iterator will only
return struct scsi_device children.  The conversion made all former
class_devices children of the device as well, so this assumption is
broken.  Fix it.

Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
  • Loading branch information
James Bottomley authored and James Bottomley committed Jul 30, 2008
1 parent 671a99c commit e8bac9e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/scsi/scsi_transport_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,14 @@ spi_transport_rd_attr(rti, "%d\n");
spi_transport_rd_attr(pcomp_en, "%d\n");
spi_transport_rd_attr(hold_mcs, "%d\n");

/* we only care about the first child device so we return 1 */
/* we only care about the first child device that's a real SCSI device
* so we return 1 to terminate the iteration when we find it */
static int child_iter(struct device *dev, void *data)
{
struct scsi_device *sdev = to_scsi_device(dev);
if (!scsi_is_sdev_device(dev))
return 0;

spi_dv_device(sdev);
spi_dv_device(to_scsi_device(dev));
return 1;
}

Expand Down

0 comments on commit e8bac9e

Please sign in to comment.