NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/52580: audio: init_output/input called multiple times per open



>Number:         52580
>Category:       kern
>Synopsis:       audio: init_output/input called multiple times per open
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 30 06:30:00 +0000 2017
>Originator:     Tetsuya Isaki
>Release:        NetBSD 8.99.3
>Organization:
>Environment:
NetBSD 8.99.3 i386
>Description:
When open an audio device for writing, hw->init_output() is called
multiple times.  This call should only be one at a time.

Similarly, when open an audio device for reading, hw->init_input()
is called multiple times.  This call should also only be one at a time.
>How-To-Repeat:
Run audioplay(1)/audiorecord(1).
Even if your device does not use init_input/output method,
the problem can be easily seen 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,


% audioplay music.au
hw->init_output
hw->init_output
% audioplay music.au
hw->init_output
hw->init_output
hw->init_output

>Fix:
N/A



Home | Main Index | Thread Index | Old Index