On Sat, Aug 11, 2001 at 03:22:21PM +0900, I wrote:
> >  - unloading snd_ds1 always panics(either when it's loaded from
> >     /boot/loader.conf, or from the command line by kldload).
> >  - loading and unloading snd_pcm alone does not panic(snd_pcm is a driver
> >     loaded as dependency when snd_ds1 is loaded).
> >  - unloading some other modules does not panic.
> >  - the last kernel I remember that didn't panic was from 2001. .
> And attached is a patch to kern_sysctl.c I'm using currently as a workaround.
> It just adds a test mode to internal sysctl_remove_oid() and avoid
> reregistering removed oid in sysctl_ctx_free().

Would someone please commit this or any better version? I think this is not
specific to snd_ds1, but a small bug in kern_sysctl.c .

0. A KLD driver allocates an oid with OID_AUTO specified. It's assigned
    oid_number >= 0x100.
1. When the driver is unloaded, sysctl_ctx_free() is called from detach
    routine in a KLD driver.
2. Inside sysctl_ctx_free(), sysctl_remove_oid() is issued for each context
    entry to make sure the entire list can really be freed. If failed,
    it tries to restore once removed entries back to the list by
3. sysctl_register_oid() rejects a dynamically allocated oid and panic.

The "FIXME" code worked without a pain before kern_sysctl.c, rev 1.112
because sysctl_register_oid() didn't check if oid_number is below the range
reserved for dynamic assignment of oid_number.

[patch in <[EMAIL PROTECTED]> omitted]

By the way, I found recently that flood-pinging a PCCARD NIC(which shares
irq9 with snd_ds1 driver) seems to make my non-working dsp device play sound.
Really weird.

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

Reply via email to