diff options
| author | Takashi Iwai <tiwai@suse.de> | 2026-06-06 18:11:40 +0200 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2026-06-07 09:23:33 +0200 |
| commit | da3039e91d1f835874ed6e9a33ea19ee80c2cb92 (patch) | |
| tree | c19d55aea2d130e55dc3e1caaf4c2a52af415e4e /drivers/media/pci/b2c2/git@git.tavy.me:linux.git | |
| parent | 2b5ff4db5d7aa5b981d966df02e687f79ad7b311 (diff) | |
ALSA: timer: Forcibly close timer instances at closing
When snd_timer object is freed via snd_timer_free() and still pending
snd_timer_instance objects are assigned to the timer object, it tries
to unlink all instances and just set NULL to each ti->timer, then
releases the resources immediately. The problem is, however, when
there are slave timer instances that are associated with a master
instance linked to this timer: namely, those slave instances still
point to the freed timer object although the master instance is
unlinked, which may lead to user-after-free. The bug can be easily
triggered particularly when a new userspace-driven timers
(CONFIG_SND_UTIMER) is involved, since it can create and delete the
timer object via a simple file open/close, while the other
applications may keep accessing to that timer.
This patch is an attempt to paper over the problem above: now instead
of just unlinking, call snd_timer_close[_locked]() forcibly for each
pending timer instance, so that all assigned slave timer instances are
properly detached, too. Since snd_timer_close() might be called later
by the driver that created that instance, the check of
SNDRV_TIMER_IFLG_DEAD is added at the beginning, too.
Reported-by: Kyle Zeng <kylebot@openai.com>
Tested-by: Kyle Zeng <kylebot@openai.com>
Fixes: 37745918e0e7 ("ALSA: timer: Introduce virtual userspace-driven timers")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260606161145.1933447-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'drivers/media/pci/b2c2/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
