summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound
diff options
context:
space:
mode:
authorcem <cem@FreeBSD.org>2016-04-20 05:11:00 +0000
committercem <cem@FreeBSD.org>2016-04-20 05:11:00 +0000
commit3f43456e6ff56c1dfc748d71e77968629f209aac (patch)
treee3f3b0a42c327d3f46a0ee425bbd8cce1afce1b9 /sys/dev/sound
parent62fb6917238c65fe51b0be78a160203b02921685 (diff)
downloadFreeBSD-src-3f43456e6ff56c1dfc748d71e77968629f209aac.zip
FreeBSD-src-3f43456e6ff56c1dfc748d71e77968629f209aac.tar.gz
sound(4): Don't use-after-free in midi module unload
Also, use ANSI function parameter definitions (void) while here. Reported by: Coverity CID: 1006107 Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'sys/dev/sound')
-rw-r--r--sys/dev/sound/midi/midi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c
index daa34ed..4c6fe2e 100644
--- a/sys/dev/sound/midi/midi.c
+++ b/sys/dev/sound/midi/midi.c
@@ -1401,7 +1401,7 @@ midi_destroy(struct snd_midi *m, int midiuninit)
*/
static int
-midi_load()
+midi_load(void)
{
mtx_init(&midistat_lock, "midistat lock", NULL, 0);
TAILQ_INIT(&midi_devs); /* Initialize the queue. */
@@ -1414,9 +1414,9 @@ midi_load()
}
static int
-midi_unload()
+midi_unload(void)
{
- struct snd_midi *m;
+ struct snd_midi *m, *tmp;
int retval;
MIDI_DEBUG(1, printf("midi_unload()\n"));
@@ -1425,7 +1425,7 @@ midi_unload()
if (midistat_isopen)
goto exit0;
- TAILQ_FOREACH(m, &midi_devs, link) {
+ TAILQ_FOREACH_SAFE(m, &midi_devs, link, tmp) {
mtx_lock(&m->lock);
if (m->busy)
retval = EBUSY;
OpenPOWER on IntegriCloud