NetBSD Problem Report #52581
From www@NetBSD.org Sat Sep 30 06:34:05 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id D69877A180
for <gnats-bugs@gnats.NetBSD.org>; Sat, 30 Sep 2017 06:34:04 +0000 (UTC)
Message-Id: <20170930063403.D765F7A1FF@mollari.NetBSD.org>
Date: Sat, 30 Sep 2017 06:34:03 +0000 (UTC)
From: isaki@pastel-flower.jp
Reply-To: isaki@pastel-flower.jp
To: gnats-bugs@NetBSD.org
Subject: audio: open(O_RDONLY) calls init_output
X-Send-Pr-Version: www-1.0
>Number: 52581
>Category: kern
>Synopsis: audio: open(O_RDONLY) calls init_output
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: nat
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Sep 30 06:35:00 +0000 2017
>Closed-Date: Fri Oct 27 20:55:51 +0000 2017
>Last-Modified: Fri Oct 27 20:55:51 +0000 2017
>Originator: Tetsuya Isaki
>Release: NetBSD 8.99.3
>Organization:
>Environment:
NetBSD 8.99.3 i386
>Description:
When open an audio device with O_RDONLY (for recording), hw->init_output()
is also called. It should not be called for recording.
>How-To-Repeat:
Run audiorecord(1) with this patch.
--- sys/dev/audio.c
+++ sys/dev/audio.c
@@ -2028,6 +2028,7 @@ audio_initbufs(struct audio_softc *sc, struct virtual_channel *vc)
audio_init_ringbuffer(sc, &vc->sc_mrr,
AUMODE_RECORD);
if (sc->sc_opens == 0 && (vc->sc_mode & AUMODE_RECORD)) {
+printf("hw->init_input\n");
if (hw->init_input) {
error = hw->init_input(sc->hw_hdl,
vc->sc_mrr.s.start,
@@ -2044,6 +2045,7 @@ audio_initbufs(struct audio_softc *sc, struct virtual_channel *vc)
AUMODE_PLAY);
vc->sc_sil_count = 0;
if (sc->sc_opens == 0 && (vc->sc_mode & AUMODE_PLAY)) {
+printf("hw->init_output\n");
if (hw->init_output) {
error = hw->init_output(sc->hw_hdl,
vc->sc_mpr.s.start,
% audiorecord rec.wav
hw->init_output
hw->init_input
hw->init_input
>Fix:
N/A
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->nat
Responsible-Changed-By: nat@NetBSD.org
Responsible-Changed-When: Sun, 01 Oct 2017 21:42:14 +0000
Responsible-Changed-Why:
Take.
From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/52581 CVS commit: src/sys/dev
Date: Sun, 1 Oct 2017 21:49:20 +0000
Module Name: src
Committed By: nat
Date: Sun Oct 1 21:49:20 UTC 2017
Modified Files:
src/sys/dev: audio.c
Log Message:
Ensure proper use of sc_opens (play back) and sc_recopens (recording).
Fix logic for /dev/sound so audiosetinfo is only called once.
These changes are to ensure that init_output/input is only called once for
the respective function play back or recording. For multiple recording or
plack back streams init_input/output is only called once fot the first
play/rec stream.
This addresses PR kern/52580, PR kern/52581 and PR kern/52582 analyzed and
reported by isaki@.
To generate a diff of this commit:
cvs rdiff -u -r1.409 -r1.410 src/sys/dev/audio.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: nat@NetBSD.org
State-Changed-When: Fri, 27 Oct 2017 20:55:51 +0000
State-Changed-Why:
This has been fixed. Thanks for the analysis and PR!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.