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 1B9E4142648 for ; Tue, 21 May 2024 14:38: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=1716302327; cv=none; b=WqpzuggaEF6Y0D2x+gotU00mYwYzIy/oGGovp2g/36vMTu1RiWMNs2IcbT2TgJlWljX8gWnwYINBTiS5afbQ1LXNbvk5xRnv+EaRlMV6qNDszo9kOiUvIF5Pw9LT8M6hM0Bn9byYp1SKfYeFX143Xlkp9B5TleWOkEjsNPUJiqk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716302327; c=relaxed/simple; bh=wWpIYvQ6aXM3G1mrwCL2WwLQM0N9ygD5oOmkSIeURMQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=D7AmLSlYMhHL2y4fA6YXRyL/9ZDh9VTaPmrA6KT0mY6FUtVRDefNnC/eRYOWiIVl2jxk14j/JoDVpEzPPONH8PK9IY5fieQ6gz6sFHfrVyS/QGOF9KLKtL2HiH1Sh9nQfwt6FwiUvXKXqSlfUc0YX2P8KZu4+cEFiFCqBGx8AKU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=W7mF0ooK; 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="W7mF0ooK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D3A8C2BD11; Tue, 21 May 2024 14:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716302326; bh=wWpIYvQ6aXM3G1mrwCL2WwLQM0N9ygD5oOmkSIeURMQ=; h=From:To:Cc:Subject:Date:Reply-to:From; b=W7mF0ooKFCjqXM9B8dTCWwfadmBwt7rSNuaqGP4QrqNRVV1ejYos9QRkQNHMocEek RHRDtkwxmHR8nPI3mKyGCAdGVVzdCpRWLK1KgV5LHvgKd3/Z47EHGqgvRsRWzBtbUa V90dVBeeN+wUt5xLCnD9MqiRfVogt5qznhbj9COs= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47318: arch_topology: Avoid use-after-free for scale_freq_data Date: Tue, 21 May 2024 16:35:52 +0200 Message-ID: <2024052131-CVE-2021-47318-fffb@gregkh> X-Mailer: git-send-email 2.45.1 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=2584; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=wWpIYvQ6aXM3G1mrwCL2WwLQM0N9ygD5oOmkSIeURMQ=; b=owGbwMvMwCRo6H6F97bub03G02pJDGk+G41XzX4+17W4r8e9UfRj1FzvVwqs3+fufLp27qIPc buny85M6YhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJNBkxLFjgtkhlngrjR4MG 009HLY8rZS0RDGZYcEY2O1jk9FkjgaU2B1crNqat77OrAgA= 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: arch_topology: Avoid use-after-free for scale_freq_data Currently topology_scale_freq_tick() (which gets called from scheduler_tick()) may end up using a pointer to "struct scale_freq_data", which was previously cleared by topology_clear_scale_freq_source(), as there is no protection in place here. The users of topology_clear_scale_freq_source() though needs a guarantee that the previously cleared scale_freq_data isn't used anymore, so they can free the related resources. Since topology_scale_freq_tick() is called from scheduler tick, we don't want to add locking in there. Use the RCU update mechanism instead (which is already used by the scheduler's utilization update path) to guarantee race free updates here. synchronize_rcu() makes sure that all RCU critical sections that started before it is called, will finish before it returns. And so the callers of topology_clear_scale_freq_source() don't need to worry about their callback getting called anymore. The Linux kernel CVE team has assigned CVE-2021-47318 to this issue. Affected and fixed versions =========================== Issue introduced in 5.13 with commit 01e055c120a4 and fixed in 5.13.4 with commit ccdf7e073170 Issue introduced in 5.13 with commit 01e055c120a4 and fixed in 5.14 with commit 83150f5d05f0 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-2021-47318 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: drivers/base/arch_topology.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/ccdf7e073170886bc370c613e269de610a794c4a https://git.kernel.org/stable/c/83150f5d05f065fb5c12c612f119015cabdcc124