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 617CF3D88F6; Tue, 16 Jun 2026 18:23:15 +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=1781634196; cv=none; b=uCNNpEwjftWpI7CtjvASvCVe+tze3HOPgo+X/4K+rQAyxjwJj+Eld2CMp2BsmiZ4HRuck0n5ylfyc0fg/CtElSzx8acxPtJJySuLskpznmRzSoeRO/rXPfCyNFFGhBBF1IeiOuuXrueFhWLIoYdTm64KMTCfjnT1eEEk1l4UrI0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781634196; c=relaxed/simple; bh=0JfkH+Rz4h8Ydi4By+SSyoc6O2IjfhK0zflrcJSxnG0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lr25/q4IPxz3w2rkMFVbUrNwwxh2WQmlq5+Su7CAonfBMiXhfi+OyWcAgzQI+ZcA/luv9enC2qgQFg/uXaq3AeCuFTcPBeLOEHHCKAV71LO+f7l0PfnyjBAOSHuMJWfeURHeN3WEaCcdwYj84/kaeEae3CGh4/AXE2dlvbiYuo8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HtCzaYmv; 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="HtCzaYmv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66BD61F000E9; Tue, 16 Jun 2026 18:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781634195; bh=SHGNkXKehhnhCFEuweLSFvgjdVOyMv3VpmRTwVgmJho=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HtCzaYmv7m5jpsr8LFxLLtFmm3NG1zaJrF/xtTVzbaVR1Man7wQTic6GvFn7RPccY pGdrjNOIr4kG0aOg4v9Cf5CdszIuCLOI68pJN9pNYEqcwhktd2GlKDgLWMtIdahRDy cV+MMwleFjh4XJjlUbwh0fIFCHnJ9Ec0PwGEcsNk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kyle Zeng , Takashi Iwai Subject: [PATCH 5.15 209/411] ALSA: timer: Fix UAF at snd_timer_user_params() Date: Tue, 16 Jun 2026 20:27:27 +0530 Message-ID: <20260616145111.859572641@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145100.376842714@linuxfoundation.org> References: <20260616145100.376842714@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 5.15-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 @@ -1842,6 +1842,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;