From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D24C47B435; Tue, 16 Jun 2026 17:07:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781629627; cv=none; b=dVUGiPWU+o8nl8vKdm/Wyy+gEF8HS529reNKAEGSUC59m3TqWmiVenlPkk4ylaY+lpFM27b3r1QavAmy8zJo3sDYzEF21xOEp1kGO/QFIY55VTPEVsL+/Ag2nLeUIIvkQgQVKqeIO+rAy2sKQEU10uIRs8u3ibgAFD0xJwPUF74= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781629627; c=relaxed/simple; bh=MP7JurYpmnKh11hfQGNEh/hF+88UZIZKfmcqo64qS/o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u92Fu2tADupXOfTAqTFylT1cDanMHV26StQFOFrWVKAO0iWiK2XO2Qn1BtyYu10DE3OJsp58H/J0N0AGQynQ36Y/HWyRVdA3of6jpWW9KNvKPga1RACFhOeciPOReINntfgCOKprNKlMXtLX1yP9zKabN43cxE+fMIySSg4BKc4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MbA1ALly; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="MbA1ALly" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E178F1F000E9; Tue, 16 Jun 2026 17:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781629625; bh=eEUxuUx27SrlHfCX9RDUes1bda6rDfOFfORx4jj8jZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MbA1ALlyBTAk925ULhnINGP7YQlvp/+J1Xa3Aq85U48R8oKzS9uzIkvax8ci6Doc8 gQVEaudHO/tJ+MNEyAgp0/h3JABI3w63+USStKggbS5ogDyTOkl12SFCBMtfA4FQge 4i6m1DnazrpjwRbdj67vtUYNgdd57pN0UUxzSMD4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kyle Zeng , Takashi Iwai Subject: [PATCH 6.6 304/452] ALSA: timer: Fix UAF at snd_timer_user_params() Date: Tue, 16 Jun 2026 20:28:51 +0530 Message-ID: <20260616145133.478722558@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145117.796205997@linuxfoundation.org> References: <20260616145117.796205997@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Takashi Iwai commit 053a401b592be424fea9d57c789f66cd5d8cec11 upstream. At releasing a timer object, e.g. when a userspace timer (CONFIG_SND_UTIMER) gets closed and snd_timer_free() is called, it tries to detach the timer instances and release the resources. However, it's still possible that other in-flight tasks are holding the timer instance where the to-be-deleted timer object is associated, and this may lead to racy accesses. Fortunately, most of ioctls dealing with the timer instance list already have the protection with register_mutex, and this also avoids such races. But, SNDRV_TIMER_IOCTL_PARAMS isn't protected, hence the concurrent ioctl may lead to use-after-free. This patch just adds the guard with register_mutex to protect snd_timer_user_params() for covering the code path as a quick workaround. It's no hot-path but rather a rarely issued ioctl, so the performance penalty doesn't matter. Reported-by: Kyle Zeng Tested-by: Kyle Zeng Cc: Link: https://patch.msgid.link/20260606161145.1933447-2-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/core/timer.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1850,6 +1850,7 @@ static int snd_timer_user_params(struct struct snd_timer *t; int err; + guard(mutex)(®ister_mutex); tu = file->private_data; if (!tu->timeri) return -EBADFD;