Calling freeenv with the pointerm different from one received from
getenv seldom is a good idea :) Indeed, CURRENT panics with the
following stack trace (patch below fixes that):

_mtx_lock_sleep(c08300e4,0,c03644b1,649,c08300e4) at
_mtx_lock_sleep+0x122
_mtx_lock_flags(c08300e4,0,c03644b1,649,c03a7b60) at
_mtx_lock_flags+0x67
uma_zfree_arg(c0830000,cca34d5f,cca34ef8,cca34d5f,5) at
uma_zfree_arg+0x3e
free(cca34d5f,c03a7b60,c04ddc44,c015d9ce,cca34d5f) at free+0x6c
freeenv(cca34d5f,cca41070,cc3d5100,c04ddc60,c04ddc64) at freeenv+0x1a
acpi_disabled(c0326287) at acpi_disabled+0x96
acpi_ec_probe(ccac1100,ccac1100,cc3d5100,ccac1100,0) at
acpi_ec_probe+0x96
device_probe_child(cc3d5100,ccac1100,ccac1100,cc3d5100,cc3d5100) at
device_probe_child+0xce
device_probe_and_attach(ccac1100) at device_probe_and_attach+0x41
bus_generic_attach(cc3d5100,cc3d5100,c6d83f20,c6d83f00,c6d5a700) at
bus_generic_attach+0x16
acpi_probe_children(cc3d5100) at acpi_probe_children+0x6a
acpi_attach(cc3d5100,cc3d5100,cc3d5a00,cc3d5a00,1) at acpi_attach+0x2bd
device_probe_and_attach(cc3d5100) at device_probe_and_attach+0x9a
bus_generic_attach(cc3d5a00,cca6b090,cc3d5c80,c04ddd5c,c020ad66) at
bus_generic_attach+0x16
nexus_attach(cc3d5a00,cc3d5a00,c037ace4,4e2000,1) at nexus_attach+0xe
device_probe_and_attach(cc3d5a00) at device_probe_and_attach+0x9a
root_bus_configure(cc3d5c80,c03675a0,0,4) at root_bus_configure+0x16
configure(0,4dac00,4da000,0,c0130d3c) at configure+0x22
mi_startup() at mi_startup+0x95
begin() at begin+0x43

Index: acpi.c
===================================================================
RCS file: /usr/ncvs/src/sys/dev/acpica/acpi.c,v
retrieving revision 1.60
diff -u -r1.60 acpi.c
--- acpi.c      19 Apr 2002 23:36:38 -0000      1.60
+++ acpi.c      24 Apr 2002 16:33:24 -0000
@@ -1590,17 +1590,18 @@
 int
 acpi_disabled(char *subsys)
 {
-    char       *cp;
+    char       *cp, *env;
     int                len;
 
-    if ((cp = getenv("debug.acpi.disable")) == NULL)
+    if ((env = getenv("debug.acpi.disable")) == NULL)
        return(0);
-    if (!strcmp(cp, "all")) {
-       freeenv(cp);
+    if (!strcmp(env, "all")) {
+       freeenv(env);
        return(1);
     }
 
     /* scan the disable list checking for a match */
+    cp = env;
     for (;;) {
        while ((*cp != 0) && isspace(*cp))
            cp++;
@@ -1610,12 +1611,12 @@
        while ((cp[len] != 0) && !isspace(cp[len]))
            len++;
        if (!strncmp(cp, subsys, len)) {
-           freeenv(cp);
+           freeenv(env);
            return(1);
        }
        cp += len;
     }
-    freeenv(cp);
+    freeenv(env);
     return(0);
 }


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to