Skip to content

Commit 5a48144

Browse files
tiwaigregkh
authored andcommitted
ALSA: seq: oss: Serialize ioctls
commit 80982c7 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0216f88 commit 5a48144

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
@@ -181,10 +181,16 @@ static long
181181
odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
182182
{
183183
struct seq_oss_devinfo *dp;
184+
long rc;
185+
184186
dp = file->private_data;
185187
if (snd_BUG_ON(!dp))
186188
return -ENXIO;
187-
return snd_seq_oss_ioctl(dp, cmd, arg);
189+
190+
mutex_lock(&register_mutex);
191+
rc = snd_seq_oss_ioctl(dp, cmd, arg);
192+
mutex_unlock(&register_mutex);
193+
return rc;
188194
}
189195

190196
#ifdef CONFIG_COMPAT

0 commit comments

Comments
 (0)