Commit e8bac9e0647dd04c83fd0bfe7cdfe2f6dfb100d0
1 parent
671a99c8eb
Exists in
master
and in
7 other branches
[SCSI] scsi_transport_spi: fix oops in revalidate
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>
Showing 1 changed file with 5 additions and 3 deletions Side-by-side Diff
drivers/scsi/scsi_transport_spi.c
... | ... | @@ -366,12 +366,14 @@ |
366 | 366 | spi_transport_rd_attr(pcomp_en, "%d\n"); |
367 | 367 | spi_transport_rd_attr(hold_mcs, "%d\n"); |
368 | 368 | |
369 | -/* we only care about the first child device so we return 1 */ | |
369 | +/* we only care about the first child device that's a real SCSI device | |
370 | + * so we return 1 to terminate the iteration when we find it */ | |
370 | 371 | static int child_iter(struct device *dev, void *data) |
371 | 372 | { |
372 | - struct scsi_device *sdev = to_scsi_device(dev); | |
373 | + if (!scsi_is_sdev_device(dev)) | |
374 | + return 0; | |
373 | 375 | |
374 | - spi_dv_device(sdev); | |
376 | + spi_dv_device(to_scsi_device(dev)); | |
375 | 377 | return 1; |
376 | 378 | } |
377 | 379 |