ALSA: seq: oss: Fix racy open/close of MIDI devices
authorTakashi Iwai <tiwai@suse.de>
Mon, 12 Jun 2023 12:55:33 +0000 (14:55 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 16 Jun 2023 07:26:41 +0000 (09:26 +0200)
commit297224fc0922e7385573a30c29ffdabb67f27b7d
treeb0451c5565edef3c74d8e1792d9652f4f81827ad
parenta2a871483161014f1bcc4e9a04354b01aa77cedb
ALSA: seq: oss: Fix racy open/close of MIDI devices

Although snd_seq_oss_midi_open() and snd_seq_oss_midi_close() can be
called concurrently from different code paths, we have no proper data
protection against races.  Introduce open_mutex to each seq_oss_midi
object for avoiding the races.

Reported-by: "Gong, Sishuai" <sishuai@purdue.edu>
Closes: https://lore.kernel.org/r/7DC9AF71-F481-4ABA-955F-76C535661E33@purdue.edu
Link: https://lore.kernel.org/r/20230612125533.27461-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/seq/oss/seq_oss_midi.c