From nobody@FreeBSD.org  Sat Feb 14 19:12:48 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 6E60016A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 14 Feb 2004 19:12:48 -0800 (PST)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 6AACB43D1D
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 14 Feb 2004 19:12:48 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.10/8.12.10) with ESMTP id i1F3Cm72081816
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 14 Feb 2004 19:12:48 -0800 (PST)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.10/8.12.10/Submit) id i1F3Cl1j081815;
	Sat, 14 Feb 2004 19:12:47 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200402150312.i1F3Cl1j081815@www.freebsd.org>
Date: Sat, 14 Feb 2004 19:12:47 -0800 (PST)
From: Pierre-Luc Lesprance <oksala@videotron.ca>
To: freebsd-gnats-submit@FreeBSD.org
Subject: pcm vchans related crash
X-Send-Pr-Version: www-2.0

>Number:         62862
>Category:       kern
>Synopsis:       [sound] [patch] fix pcm vchans related crash
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-multimedia
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 14 19:20:02 PST 2004
>Closed-Date:    Wed Dec 28 19:30:48 GMT 2005
>Last-Modified:  Wed Dec 28 19:30:48 GMT 2005
>Originator:     Pierre-Luc Lesprance
>Release:        4.9-p2
>Organization:
N/A
>Environment:
FreeBSD silence 4.9-RELEASE-p2 FreeBSD 4.9-RELEASE-p2 #57: Sat Feb 14 21:32:13 EST 2004     silence@silence:/usr/src/sys/compile/oksala  i386
>Description:
The system hangs if a pcm vchan is closed while it is in use. My fix simply check if some vchans are in use. 
>How-To-Repeat:
- Play a sound on a vchan
- set vchan to 0 with sysctl sysctl hw.snd.pcm0.vchans=0
>Fix:
--- sound.c.orig        Sat Feb 14 22:09:31 2004
+++ sound.c     Sat Feb 14 22:08:00 2004
@@ -810,11 +810,17 @@
        d = oidp->oid_arg1;

        pcm_lock(d);
+
        cnt = 0;
        SLIST_FOREACH(sce, &d->channels, link) {
                c = sce->channel;
                if ((c->direction == PCMDIR_PLAY) && (c->flags & CHN_F_VIRTUAL))
                        cnt++;
+                if (c->refcount > 0) {
+                        pcm_unlock(d);
+                        return EBUSY;
+                }
+                
        }
        oldcnt = cnt;
        newcnt = cnt;

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->sound 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Sep 9 20:28:26 GMT 2004 
Responsible-Changed-Why:  
This appears to be a sound-related problem. 
State-Changed-From-To: open->closed 
State-Changed-By: netchild 
State-Changed-When: Wed Dec 28 19:30:38 UTC 2005 
State-Changed-Why:  
This should be fixed in -current. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62862 
>Unformatted:
