]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ALSA: timer: Don't take register_mutex with copy_from/to_user()
authorTakashi Iwai <tiwai@suse.de>
Fri, 21 Mar 2025 17:26:52 +0000 (18:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:39:13 +0000 (14:39 +0200)
commit15291b561d8cc835a2eea76b394070cf8e072771
treea617e0acf7b53442b9bd715bf1e5121852564de7
parent11242f4b9baab6f856c2703ce777b1bf1c8bfe09
ALSA: timer: Don't take register_mutex with copy_from/to_user()

[ Upstream commit 3424c8f53bc63c87712a7fc22dc13d0cc85fb0d6 ]

The infamous mmap_lock taken in copy_from/to_user() can be often
problematic when it's called inside another mutex, as they might lead
to deadlocks.

In the case of ALSA timer code, the bad pattern is with
guard(mutex)(&register_mutex) that covers copy_from/to_user() -- which
was mistakenly introduced at converting to guard(), and it had been
carefully worked around in the past.

This patch fixes those pieces simply by moving copy_from/to_user() out
of the register mutex lock again.

Fixes: 3923de04c817 ("ALSA: pcm: oss: Use guard() for setup")
Reported-by: syzbot+2b96f44164236dda0f3b@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/67dd86c8.050a0220.25ae54.0059.GAE@google.com
Link: https://patch.msgid.link/20250321172653.14310-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/core/timer.c