Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1F89523AD for ; Mon, 1 Apr 2024 08:35:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711960547; cv=none; b=DoFzTJek2++FiMdwWDefGmCg0F2kU2iFkMq9U+vQe/KFiSf3rhEEcvcD53orr6FPoAaUfxP8RMCJsqI5IUVR4WGl34Nlix4QsWhMXk0C/at9FDtye67svw8+w7ZOdtNj9PoKiZknoLHZYWpf1x68F3J2Flf0Wi1DUxaEW3hqtRw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711960547; c=relaxed/simple; bh=Z5AEasqUQCiE+PcDVLJ5NJVwHh5dzu4E0kgj6Ctejkg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=imtzJV2ao/8bdkHrU9vFIcIt3Xd8U/2VYMWRJiom+PKd65/FOQywuwaaHCpbVqKxTiYLYtFD5VTJxxBermcIABIyhmUFqmyHWbxLAqaEBfMMFvw+9XyuYBRmviBf+N0m+DOLvVJ42IotOekDcPnU4sVYwG0G7ids1THJ1axizRY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ifeGiZiU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ifeGiZiU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DB90C433F1; Mon, 1 Apr 2024 08:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1711960546; bh=Z5AEasqUQCiE+PcDVLJ5NJVwHh5dzu4E0kgj6Ctejkg=; h=From:To:Cc:Subject:Date:Reply-to:From; b=ifeGiZiUl0Bc5GxzMAppU1YD0Tmgz+IQQsp/rDX5Cob55dMS/GD6YE5SvWD7XETdQ BUJiis1yeJZI7Y5lTtFakidOe0pT/NMbw72IEiuTgN/2b8/NzGiHCn+5O4EsU+josL wlROEZpFmBETGsH+nu7OhIxEGta7Wt3LnVAYmCAk= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-26654: ALSA: sh: aica: reorder cleanup operations to avoid UAF bugs Date: Mon, 1 Apr 2024 10:35:43 +0200 Message-ID: <2024040142-CVE-2024-26654-aa6c@gregkh> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=2731; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Z5AEasqUQCiE+PcDVLJ5NJVwHh5dzu4E0kgj6Ctejkg=; b=owGbwMvMwCRo6H6F97bub03G02pJDGlchfcuvbr6RK8hqqZhhtXFR0rnXmiw3Jy5QNaO78Aaj gN8Lnd2dcSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBE8hIY5in7ujjr2Dg/fvud 7WhgjKtS3YSSHIY5fEmOW54KaH/Oz8rs5g1t3arMVxABAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: ALSA: sh: aica: reorder cleanup operations to avoid UAF bugs The dreamcastcard->timer could schedule the spu_dma_work and the spu_dma_work could also arm the dreamcastcard->timer. When the snd_pcm_substream is closing, the aica_channel will be deallocated. But it could still be dereferenced in the worker thread. The reason is that del_timer() will return directly regardless of whether the timer handler is running or not and the worker could be rescheduled in the timer handler. As a result, the UAF bug will happen. The racy situation is shown below: (Thread 1) | (Thread 2) snd_aicapcm_pcm_close() | ... | run_spu_dma() //worker | mod_timer() flush_work() | del_timer() | aica_period_elapsed() //timer kfree(dreamcastcard->channel) | schedule_work() | run_spu_dma() //worker ... | dreamcastcard->channel-> //USE In order to mitigate this bug and other possible corner cases, call mod_timer() conditionally in run_spu_dma(), then implement PCM sync_stop op to cancel both the timer and worker. The sync_stop op will be called from PCM core appropriately when needed. The Linux kernel CVE team has assigned CVE-2024-26654 to this issue. Affected and fixed versions =========================== Issue introduced in 2.6.23 with commit 198de43d758c and fixed in 6.9-rc2 with commit 051e0840ffa8 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2024-26654 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: sound/sh/aica.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/051e0840ffa8ab25554d6b14b62c9ab9e4901457