Commit f5e94b4c authored by Takashi Iwai's avatar Takashi Iwai

ALSA: seq: oss: Fix unbalanced use lock for synth MIDI device

When get_synthdev() is called for a MIDI device, it returns the fixed
midi_synth_dev without the use refcounting.  OTOH, the caller is
supposed to unreference unconditionally after the usage, so this would
lead to unbalanced refcount.

This patch corrects the behavior and keep up the refcount balance also
for the MIDI synth device.

Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent ab3b8e51
...@@ -363,10 +363,14 @@ get_synthdev(struct seq_oss_devinfo *dp, int dev) ...@@ -363,10 +363,14 @@ get_synthdev(struct seq_oss_devinfo *dp, int dev)
return NULL; return NULL;
if (! dp->synths[dev].opened) if (! dp->synths[dev].opened)
return NULL; return NULL;
if (dp->synths[dev].is_midi) if (dp->synths[dev].is_midi) {
return &midi_synth_dev; rec = &midi_synth_dev;
if ((rec = get_sdev(dev)) == NULL) snd_use_lock_use(&rec->use_lock);
} else {
rec = get_sdev(dev);
if (!rec)
return NULL; return NULL;
}
if (! rec->opened) { if (! rec->opened) {
snd_use_lock_free(&rec->use_lock); snd_use_lock_free(&rec->use_lock);
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment