Skip to content

Commit 80982c7

Browse files
committed
ALSA: seq: oss: Serialize ioctls
Some ioctls via OSS sequencer API may race and lead to UAF when the port create and delete are performed concurrently, as spotted by a couple of syzkaller cases. This patch is an attempt to address it by serializing the ioctls with the existing register_mutex. Basically OSS sequencer API is an obsoleted interface and was designed without much consideration of the concurrency. There are very few applications with it, and the concurrent performance isn't asked, hence this "big hammer" approach should be good enough. Reported-by: [email protected] Reported-by: [email protected] Suggested-by: Hillf Danton <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent cd72c31 commit 80982c7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sound/core/seq/oss/seq_oss.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,16 @@ static long
168168
odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
169169
{
170170
struct seq_oss_devinfo *dp;
171+
long rc;
172+
171173
dp = file->private_data;
172174
if (snd_BUG_ON(!dp))
173175
return -ENXIO;
174-
return snd_seq_oss_ioctl(dp, cmd, arg);
176+
177+
mutex_lock(&register_mutex);
178+
rc = snd_seq_oss_ioctl(dp, cmd, arg);
179+
mutex_unlock(&register_mutex);
180+
return rc;
175181
}
176182

177183
#ifdef CONFIG_COMPAT

0 commit comments

Comments
 (0)