From owner-freebsd-current@FreeBSD.ORG Tue Jan 13 23:21:22 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 03F5D16A4CE for ; Tue, 13 Jan 2004 23:21:22 -0800 (PST) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id C89DC43D31 for ; Tue, 13 Jan 2004 23:21:20 -0800 (PST) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.9p2/8.12.9) with ESMTP id i0E7LE7E038265 for ; Tue, 13 Jan 2004 23:21:18 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <200401140721.i0E7LE7E038265@gw.catspoiler.org> Date: Tue, 13 Jan 2004 23:21:14 -0800 (PST) From: Don Lewis To: current@FreeBSD.org In-Reply-To: <1073574241.667.19.camel@localhost> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Subject: Re: sound/pcm/* bugs (was: Re: page fault panic tracked down (selwakeuppri()) - really sound/pcm/*) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jan 2004 07:21:22 -0000 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++) {