Patch "ALSA: timer: Add missing mutex lock for compat ioctls" has been added to the 3.18-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
ALSA: timer: Add missing mutex lock for compat ioctls
to the 3.18-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
alsa-timer-add-missing-mutex-lock-for-compat-ioctls.patch
and it can be found in the queue-3.18 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
79fb0518fec8c8b4ea7f1729f54f293724b3dbb0Mon Sep 17 00:00:00 2001
From: Takashi Iwai <[email protected]>
Date: Sun, 29 Oct 2017 11:02:04 +0100
Subject: ALSA: timer: Add missing mutex lock for compat ioctls
From: Takashi Iwai <[email protected]>
commit 79fb0518fec8c8b4ea7f1729f54f293724b3dbb0 upstream.
The races among ioctl and other operations were protected by the commit af368027a49a ("ALSA: timer: Fix race among timer ioctls") and later fixes, but one code path was forgotten in the scenario: the 32bit compat ioctl. As syzkaller recently spotted, a very similar use-after-free may happen with the combination of compat ioctls.
The fix is simply to apply the same ioctl_lock to the compat_ioctl callback, too.
Reference: http://lkml.kernel.org/r/[email protected]
--- sound/core/timer_compat.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
sound/core/timer_compat.c +15 -2
@@ -106,7 +106,8 @@ enum {#endif /* CONFIG_X86_X32 */ }; -static long snd_timer_user_ioctl_compat (struct file *file,unsigned int cmd,unsigned long arg) +static long __snd_timer_user_ioctl_compat (struct file *file,unsigned int cmd, +unsigned long arg) {void __user *argp =compat_ptr (arg);
@@ -127,7 +128,7 @@ static long snd_timer_user_ioctl_compat(case SNDRV_TIMER_IOCTL_PAUSE :case SNDRV_TIMER_IOCTL_PAUSE_OLD :case SNDRV_TIMER_IOCTL_NEXT_DEVICE : -return snd_timer_user_ioctl (file, cmd, (unsigned long )argp); +return __snd_timer_user_ioctl (file, cmd, (unsigned long )argp);case SNDRV_TIMER_IOCTL_INFO32 :return snd_timer_user_info_compat (file, argp);case SNDRV_TIMER_IOCTL_STATUS32 :
@@ -139,3 +140,15 @@ static long snd_timer_user_ioctl_compat( }return -ENOIOCTLCMD ; } + +static long snd_timer_user_ioctl_compat (struct file *file,unsigned int cmd, +unsigned long arg) +{ +struct snd_timer_user *tu = file->private_data; +long ret; + +mutex_lock (&tu->ioctl_lock); + ret =__snd_timer_user_ioctl_compat (file, cmd, arg); +mutex_unlock (&tu->ioctl_lock); +return ret; +}
Patches currently in stable-queue which might be from [email protected] are
queue-3.18/alsa-seq-fix-nested-rwsem-annotation-for-lockdep-splat.patch queue-3.18/alsa-timer-add-missing-mutex-lock-for-compat-ioctls.patch