]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: rawmidi: Check stream state at exported functions
authorTakashi Iwai <tiwai@suse.de>
Fri, 17 Jun 2022 14:40:50 +0000 (16:40 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 20 Jun 2022 07:36:03 +0000 (09:36 +0200)
commit75433219672c1ea686fdb786173bd86a1c4c4b33
tree44eaf3cba678d83f5fc6310babf3939468006fa6
parent7ddc53d281f4962a6ecd5dfa7efa1e325e802a21
ALSA: rawmidi: Check stream state at exported functions

The rawmidi interface provides some exported functions to be called
from outside, and currently there is no state check for those calls
whether the stream is properly opened and running.  Although such an
invalid call shouldn't happen, but who knows.

This patch adds the proper rawmidi stream state checks with spinlocks
for avoiding unexpected accesses when such exported functions are
called in an invalid state.  After this patch, with the
substream->opened and substream->runtime are always tied and
guaranteed to be set under substream->lock.

Link: https://lore.kernel.org/r/20220617144051.18985-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/rawmidi.c