Date: Tue, 13 Jan 2004 23:21:14 -0800 (PST) From: Don Lewis <truckman@FreeBSD.org> To: current@FreeBSD.org Subject: Re: sound/pcm/* bugs (was: Re: page fault panic tracked down (selwakeuppri()) - really sound/pcm/*) Message-ID: <200401140721.i0E7LE7E038265@gw.catspoiler.org> In-Reply-To: <1073574241.667.19.camel@localhost>
next in thread | previous in thread | raw e-mail | index | archive | help
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++) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401140721.i0E7LE7E038265>
