sound/pcm/* bugs (was: Re: page fault panic tracked down
(selwakeuppri()) - really sound/pcm/*)
Don Lewis
truckman at FreeBSD.org
Tue Jan 13 23:21:22 PST 2004
On 8 Jan, Ryan Sommers wrote:
> While you guys are looking in snd_pcm here is a bug someone pointed out
> to on the lists in another form that I narrowed down.
>
> If you build snd_pcm and your another driver as modules and then only
> load snd_pcm.ko and not load your more specific driver you can panic the
> system every time by doing a "sysctl hw.snd.maxautovchans=(something
> other then current)". This has been sitting in my TODO list for awhile
> but I know nothing about sound driver code so you'd probably have more
> luck then I would. :) I'll attach the backtrace I grabbed from my latest
> CURRENT kernel. (I haven't checked if this is in a PR or not yet.)
The following patch prevents the panic for me. I don't know if EINVAL is
really the right error to return or if the code does the right thing if
the specific driver is loaded and unloaded ...
Index: sys/dev/sound/pcm/sound.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/sound/pcm/sound.c,v
retrieving revision 1.86
diff -u -r1.86 sound.c
--- sys/dev/sound/pcm/sound.c 8 Dec 2003 01:08:03 -0000 1.86
+++ sys/dev/sound/pcm/sound.c 14 Jan 2004 07:14:05 -0000
@@ -334,7 +334,7 @@
v = snd_maxautovchans;
error = sysctl_handle_int(oidp, &v, sizeof(v), req);
if (error == 0 && req->newptr != NULL) {
- if (v < 0 || v >= SND_MAXVCHANS)
+ if (v < 0 || v >= SND_MAXVCHANS || pcm_devclass == NULL)
return EINVAL;
if (v != snd_maxautovchans) {
for (i = 0; i < devclass_get_maxunit(pcm_devclass); i++) {
More information about the freebsd-current
mailing list