Messages in this thread | | | Date | Wed, 05 May 1999 22:17:54 -0400 | From | Douglas Gilbert <> | Subject | Re: Oops in 2.2.7 (scan_scsis) |
| |
Olaf Flebbe wrote:
> Kernel Oops in Linux Intel 2.2.7, using egcs-1.1.1. > (Oops, I though I am using gcc 2.7.2.3 ;-) > > I tried > echo "scsi add-single-device 0 0 3 0" > /proc/scsi/scsi > in order to add my scanner to the system, which had been accidently > without power at system boot time. > > Boom! My shell died with an Kernel Oops. (echo is a shell built in > command) > > Unfortunatly I cannot reproduce this error any more. > > Somehow scsi_init_malloc has returned a NULL pointer and memset tried > to write on it. It would be safer to test the result of > scsi_init_malloc. > But why did it happen? > > Please CC to me directly, I am not subscribed to linux-kernel. > > Cheers > Olaf > ------- scsi.c: scan_scsis ------- > ... > SCpnt = (Scsi_Cmnd *) scsi_init_malloc (sizeof (Scsi_Cmnd), > GFP_ATOMIC | GFP_DMA); > memset (SCpnt, 0, sizeof (Scsi_Cmnd)); <---Boom! > ...
Olaf, Very accurate debugging. The SCSI mid level has several scsi_init_malloc()s that use the GFP_DMA flag and don't bother to check if NULL is returned. The GFP_DMA flag tells the allocator that only memory below the 16MB limit is suitable (on i386).
This would be understandable if you had an ISA SCSI adapter in your machine (which can only DMA to a 24 bit address space). Sad to say the mid level uses that GFP_DMA flag irrespective of whether an ISA SCSI adapter is about.
That "add-single-device" also would have required extra SCSI command blocks to be allocated and that could have failed in the same fashion. This latter problem causes oopses when high level SCSI modules (eg sr_mod) are loaded.
I have just posted a proposal for a CONFIG_SCSI_NO_ISA switch in the linux-scsi list that will address this problem (except if you have one of those pesky ISA SCSI adapters).
Doug Gilbert
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |