Re: [PATCH] Fix SCSI proc oops

From: David S. Miller (
Date: Sat Oct 14 2000 - 04:40:06 EST

   Date: Sat, 14 Oct 2000 11:43:09 +0200
   From: Torben Mathiasen <>

   David, why is tpnt->proc_name NULL on sparc for devices not
   existing? Every driver has this as part of their tpnt struct, so
   it doesn't matter if the underlying device really exists.

In the mentioned case it would be NULL on all architectures, not just
Sparc ;-) (it happens on ix86 too, ix86 is different only because it
does not trap kernel NULL pointer derefences during bootup for some
odd reason)

Here is what happens:

        tpnt->present = tpnt->detect(tpnt);
        /* tpnt->present is zero since no such adapters were found */

If no hosts are detected the driver is under no obligation to
initialize the tpnt->proc_name field. For example,
sym53c8xx.c:sym53c8xx_detect() does not if PCI is not present and this
is the specific case hit on my SBUS-only workstation :-)

Subsequently scsi_unregister_host() is called for this TPNT and
this is where the NULL pointer is hit.

If you included this same driver on x86 and ran that kernel on
an x86 machine without PCI, the NULL pointer would occur there
too. (it just wouldn't oops on ix86, because, for the millionth time
:->, x86 does not trap kernel NULL pointer derefences which occur
during early bootup)

If we want to create the requirement that XXX_detect() in a scsi
driver must initialize tpnt->proc_name to a non-NULL value no matter
what when it is invoked, that would be a seperate issue.

David S. Miller

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sun Oct 15 2000 - 21:00:27 EST