Subject: kern/22830: DFE-580TX card causes panic during autoconf
To: None <gnats-bugs@gnats.netbsd.org>
From: None <mlelstv@serpens.de>
List: netbsd-bugs
Date: 09/17/2003 11:45:47
>Number:         22830
>Category:       kern
>Synopsis:       DFE-580TX card causes panic during autoconf
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 17 09:47:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Michael van Elst
>Release:        NetBSD 1.6.1_STABLE
>Organization:
-- 
                                Michael van Elst
Internet: mlelstv@serpens.de
                                "A potential Snark may lurk in every tree."
>Environment:
	
	
System: NetBSD fud 1.6.1_STABLE NetBSD 1.6.1_STABLE (FUD) #8: Wed Sep 17 11:29:58 MEST 2003     src@fud:/d/0/src/sys/arch/i386/compile/FUD i386
Architecture: i386
Machine: i386
>Description:
Installing a DFE-580TX card (a 4 port FastEthernet card from D-Link)
causes the kernel to panic during autoconfiguration.

The panic is called in kern/subr_extent.c line 400 because the
PCI subsystem requests allocation of an extent of size 0. You need
a kernel compiled with DIAGNOSTIC. I don't know what happens without
DIAGNOSTIC code enabled.

The erroneous request is caused by an incomplete parameter check
in dev/pci/pci_map.c

>How-To-Repeat:
Plug in a DFE-580TX card and boot a 1.6.1 kernel.

>Fix:
The problem is fixed in -current. The following patch applies the
fix to he 1.6.1 sources.

Index: dev/pci/pci_map.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/pci_map.c,v
retrieving revision 1.10
diff -u -r1.10 pci_map.c
--- dev/pci/pci_map.c   2001/11/13 07:48:47     1.10
+++ dev/pci/pci_map.c   2003/09/17 09:44:44
@@ -166,7 +166,8 @@
        waddress = (u_int64_t)address1 << 32UL | address;
        wmask = (u_int64_t)mask1 << 32UL | mask;
 
-       if (PCI_MAPREG_MEM64_SIZE(wmask) == 0) {
+       if ((is64bit && PCI_MAPREG_MEM64_SIZE(wmask) == 0) ||
+           (!is64bit && PCI_MAPREG_MEM_SIZE(mask) == 0)) {
                printf("pci_mem_find: void region\n");
                return (1);
        }

>Release-Note:
>Audit-Trail:
>Unformatted: