summaryrefslogtreecommitdiff
path: root/include/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2022-06-17 17:40:48 +0300
committerTakashi Iwai <tiwai@suse.de>2022-06-20 10:36:02 +0300
commitf1d40433352e5d4babd59c0dd50b5f9414073ddb (patch)
treefaa2d09d3e38c6e778df9ce454d3b119961bf764 /include/sound
parentcd76175a2b204911a3cddef36b99e56945b6938c (diff)
downloadlinux-f1d40433352e5d4babd59c0dd50b5f9414073ddb.tar.xz
ALSA: rawmidi: Move lock to snd_rawmidi_substream
Having a lock in snd_rawmidi_runtime can be a problem especially when a substream is accessed from the outside, as the runtime creation might be racy with the external calls. As a first step for hardening, move the spinlock from snd_rawmidi_runtime to snd_rawmidi_substream. This patch just replaces the lock calls, no real functional change is put yet. Link: https://lore.kernel.org/r/20220617144051.18985-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/rawmidi.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index 9402c25ae9ba..e1f59b2940af 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -63,7 +63,6 @@ struct snd_rawmidi_runtime {
size_t xruns; /* over/underruns counter */
int buffer_ref; /* buffer reference count */
/* misc */
- spinlock_t lock;
wait_queue_head_t sleep;
/* event handler (new bytes, input only) */
void (*event)(struct snd_rawmidi_substream *substream);
@@ -85,6 +84,7 @@ struct snd_rawmidi_substream {
unsigned int clock_type; /* clock source to use for input framing */
int use_count; /* use counter (for output) */
size_t bytes;
+ spinlock_t lock;
struct snd_rawmidi *rmidi;
struct snd_rawmidi_str *pstr;
char name[32];