NetBSD-Bugs archive

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

kern/52581: audio: open(O_RDONLY) calls init_output



>Number:         52581
>Category:       kern
>Synopsis:       audio: open(O_RDONLY) calls init_output
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 30 06:35:00 +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



Home | Main Index | Thread Index | Old Index