Skip to content

Commit cff1de8

Browse files
tiwaigregkh
authored andcommitted
ALSA: seq: oss: Fix races at processing SysEx messages
commit 0179488ca992d79908b8e26b9213f1554fc5bacc upstream. OSS sequencer handles the SysEx messages split in 6 bytes packets, and ALSA sequencer OSS layer tries to combine those. It stores the data in the internal buffer and this access is racy as of now, which may lead to the out-of-bounds access. As a temporary band-aid fix, introduce a mutex for serializing the process of the SysEx message packets. Reported-by: Kun Hu <[email protected]> Closes: https://lore.kernel.org/[email protected] Cc: <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 12539ac commit cff1de8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sound/core/seq/oss/seq_oss_synth.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ static struct seq_oss_synth midi_synth_dev = {
6666
};
6767

6868
static DEFINE_SPINLOCK(register_lock);
69+
static DEFINE_MUTEX(sysex_mutex);
6970

7071
/*
7172
* prototypes
@@ -497,6 +498,7 @@ snd_seq_oss_synth_sysex(struct seq_oss_devinfo *dp, int dev, unsigned char *buf,
497498
if (!info)
498499
return -ENXIO;
499500

501+
guard(mutex)(&sysex_mutex);
500502
sysex = info->sysex;
501503
if (sysex == NULL) {
502504
sysex = kzalloc(sizeof(*sysex), GFP_KERNEL);

0 commit comments

Comments
 (0)