Subject: port-i386/4003: if_ed.c can panic the kernel when probing a bad card
To: None <gnats-bugs@gnats.netbsd.org>
From: Martin Husemann <martin@rumolt.teuto.de>
List: netbsd-bugs
Date: 08/18/1997 06:56:34
>Number:         4003
>Category:       port-i386
>Synopsis:       when probing a failing card, if_ed.c may panic
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 17 23:20:05 1997
>Last-Modified:
>Originator:     Martin Husemann
>Organization:
UP-Vision Computergraphik GmbH, Bad Arolsen, Germany
>Release:        August 16 1997
>Environment:
System: NetBSD rumolt.teuto.de 1.2G NetBSD 1.2G (RUMOLT) #0: Sun Aug 17 10:09:23 MEST 1997 root@hwart.teuto.de:/usr/src/sys-local/arch/i386/compile/RUMOLT i386


>Description:
I have a slightly broken NE2000 clone (unused when running NetBSD) in my 
system. Sometimes (exspecialy when rebooting after running NT) the card
fails some probe logic in if_ed.c and tricks it into thinking it's a
WD80x-something.

Since it's configured without shared memory (which it doesn't have) it
causes a panic when if_ed.c tries to map the shared memory for the card
starting at address -1.

>How-To-Repeat:
Not easy; but see code and fix below.

>Fix:
*** /sys/dev/isa/if_ed.c	Thu Jun  5 13:22:48 1997
--- if_ed.c	Mon Aug 18 08:59:53 1997
***************
*** 507,516 ****
--- 507,518 ----
  		}
  	}
  
  	/* XXX Figure out the shared memory address. */
  
+ 	if (ia->ia_maddr == MADDRUNK)
+ 		goto out;
  	sc->isa16bit = isa16bit;
  	sc->mem_shared = 1;
  	ia->ia_msize = memsize;
  	if (bus_space_map(memt, ia->ia_maddr, memsize, 0, &memh))
  		goto out;

>Audit-Trail:
>Unformatted: