Date: Wed, 20 Apr 2016 05:11:00 +0000 (UTC) From: "Conrad E. Meyer" <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298339 - head/sys/dev/sound/midi Message-ID: <201604200511.u3K5B0WJ095243@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Wed Apr 20 05:11:00 2016 New Revision: 298339 URL: https://svnweb.freebsd.org/changeset/base/298339 Log: 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 Modified: head/sys/dev/sound/midi/midi.c Modified: head/sys/dev/sound/midi/midi.c ============================================================================== --- head/sys/dev/sound/midi/midi.c Wed Apr 20 05:02:13 2016 (r298338) +++ head/sys/dev/sound/midi/midi.c Wed Apr 20 05:11:00 2016 (r298339) @@ -1401,7 +1401,7 @@ midi_destroy(struct snd_midi *m, int mid */ 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604200511.u3K5B0WJ095243>