NetBSD-Bugs archive

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

Re: kern/54427: panic in audio_close



The following reply was made to PR kern/54427; it has been noted by GNATS.

From: Tetsuya Isaki <isaki%pastel-flower.jp@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: kern-bug-people%netbsd.org@localhost,
	gnats-admin%netbsd.org@localhost,
	netbsd-bugs%netbsd.org@localhost
Subject: Re: kern/54427: panic in audio_close
Date: Fri, 02 Aug 2019 12:23:25 +0900

 At Thu,  1 Aug 2019 16:45:00 +0000 (UTC),
 coypu%sdf.org@localhost wrote:
 > >Description:
 > What I was doing: using bluetooth for an audio headset.
 > 
 > bta2dpd -a headset /dev/pad
 > audioplay -d /dev/sound2 sample.wav
 
 Yeah this is reproducible easily and I've stucked.
 
 -----
 #include <err.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <unistd.h>
 int main(int ac, char *av[])
 {
 	const char *devaudio = "/dev/audio1";	/* set your device */
 	int fdpad;
 	int fdaudio;
 	int r;
 
 	fdpad = open("/dev/pad", O_RDONLY);
 	if (fdpad == -1)
 		err(1, "open: dev/pad");
 
 	
 	fdaudio = open(devaudio, O_WRONLY);
 	if (fdaudio == -1)
 		err(1, "open: dev/audio");
 
 	close(fdpad);
 	close(fdaudio);
 	return 0;
 }
 -----
 
 First, when pad is closed, audiodetach is called from pad_close
 but it doesn't close any associated audio descriptors.
 When audio is closed then, pad(lower layer)'s resources are
 no longer available.
 
 I wonder why this code does not close descriptors...
 
 sys/dev/audio/audio.c:
    1219 audiodetach(device_t self, int flags)
    1220 {
       :
    1252     /*
    1253      * Nuke the vnodes for any open instances (calls close).
    1254      * Will wait until any activity on the device nodes has ceased.
    1255      */
    1256     mn = device_unit(self);
    1257     vdevgone(maj, mn | SOUND_DEVICE,    mn | SOUND_DEVICE, VCHR);
    1258     vdevgone(maj, mn | AUDIO_DEVICE,    mn | AUDIO_DEVICE, VCHR);
    1259     vdevgone(maj, mn | AUDIOCTL_DEVICE, mn | AUDIOCTL_DEVICE, VCHR);
    1260     vdevgone(maj, mn | MIXER_DEVICE,    mn | MIXER_DEVICE, VCHR);
  
 ---
 Tetsuya Isaki <isaki%pastel-flower.jp@localhost / isaki%NetBSD.org@localhost>
 


Home | Main Index | Thread Index | Old Index