public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* Subtle but oops causing problem with class_device->device conversion
@ 2008-07-29 17:42 James Bottomley
  2008-07-29 17:59 ` Kay Sievers
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2008-07-29 17:42 UTC (permalink / raw)
  To: Kay Sievers, Hannes Reinecke; +Cc: linux-scsi, linux-kernel

It's taken me a while to track this down.  Basically there's an oops in
scsi_transport_spi that's directly caused by this.

What happened is that you made all class devices become real devices and
be parented to devices they were formerly allied to through the class
device dev pointer.  This means that effectively you expanded the child
list of every device to include not only its real children but also its
class devices.

This breaks in device_for_each_child *if* the routine in the iterator
doesn't perform checks on the devices it gets back (scsi_transport_spi
was assuming that every device it got was embedded in a struct
scsi_device because they're the only logical children of a scsi_target).

I can fix the SCSI breakage, but the whole tree will need auditing to
check that nothing else is using this assumption.

James



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Subtle but oops causing problem with class_device->device conversion
  2008-07-29 17:42 Subtle but oops causing problem with class_device->device conversion James Bottomley
@ 2008-07-29 17:59 ` Kay Sievers
  2008-07-29 18:06   ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: Kay Sievers @ 2008-07-29 17:59 UTC (permalink / raw)
  To: James Bottomley; +Cc: Hannes Reinecke, linux-scsi, linux-kernel

On Tue, 2008-07-29 at 12:42 -0500, James Bottomley wrote:
> It's taken me a while to track this down.  Basically there's an oops in
> scsi_transport_spi that's directly caused by this.
> 
> What happened is that you made all class devices become real devices and
> be parented to devices they were formerly allied to through the class
> device dev pointer.  This means that effectively you expanded the child
> list of every device to include not only its real children but also its
> class devices.
> 
> This breaks in device_for_each_child *if* the routine in the iterator
> doesn't perform checks on the devices it gets back (scsi_transport_spi
> was assuming that every device it got was embedded in a struct
> scsi_device because they're the only logical children of a scsi_target).
> 
> I can fix the SCSI breakage, but the whole tree will need auditing to
> check that nothing else is using this assumption.

I guess it's caused by:
  [SCSI] add scsi_host and scsi_target to scsi_bus

  This patch implements scsi_host and scsi_target device types
  and adds both to the scsi_bus.
  http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=b0ed43360fdca227048d88a08290365cb681c1a8

and not by the re-parenting, so it should be limited to SCSI, right?

Thanks,
Kay


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Subtle but oops causing problem with class_device->device conversion
  2008-07-29 17:59 ` Kay Sievers
@ 2008-07-29 18:06   ` James Bottomley
  0 siblings, 0 replies; 3+ messages in thread
From: James Bottomley @ 2008-07-29 18:06 UTC (permalink / raw)
  To: Kay Sievers; +Cc: Hannes Reinecke, linux-scsi, linux-kernel

On Tue, 2008-07-29 at 19:59 +0200, Kay Sievers wrote:
> On Tue, 2008-07-29 at 12:42 -0500, James Bottomley wrote:
> > It's taken me a while to track this down.  Basically there's an oops in
> > scsi_transport_spi that's directly caused by this.
> > 
> > What happened is that you made all class devices become real devices and
> > be parented to devices they were formerly allied to through the class
> > device dev pointer.  This means that effectively you expanded the child
> > list of every device to include not only its real children but also its
> > class devices.
> > 
> > This breaks in device_for_each_child *if* the routine in the iterator
> > doesn't perform checks on the devices it gets back (scsi_transport_spi
> > was assuming that every device it got was embedded in a struct
> > scsi_device because they're the only logical children of a scsi_target).
> > 
> > I can fix the SCSI breakage, but the whole tree will need auditing to
> > check that nothing else is using this assumption.
> 
> I guess it's caused by:
>   [SCSI] add scsi_host and scsi_target to scsi_bus
> 
>   This patch implements scsi_host and scsi_target device types
>   and adds both to the scsi_bus.
>   http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=b0ed43360fdca227048d88a08290365cb681c1a8
> 
> and not by the re-parenting, so it should be limited to SCSI, right?

No .. read the email.  It's caused by adding extra children to the
device via the class_device conversion.  device_for_each_child doesn't
care what the type is (although that might be a potential generic fix
for this).

So, it's definitely not confined to SCSI.

James



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-29 18:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-29 17:42 Subtle but oops causing problem with class_device->device conversion James Bottomley
2008-07-29 17:59 ` Kay Sievers
2008-07-29 18:06   ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox