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 1009843030F; Thu, 16 Jul 2026 14:29:57 +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=1784212198; cv=none; b=OuXGkNdBhjKaNjwNuLgkeyWiW+edVyxjksYzyXvoldbtwtvmkWXD8SV9dOi+Wxg3JvWLcDIWwsjiHYpmstbFIjUcTOm0vAT6+ezzV/yS0HhJtd22uBK1PGqIbBVTT01RAtm7NxGXw9tfZPYVPpgIpPad+Bs+uiWMqjWtFCp2l9s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784212198; c=relaxed/simple; bh=OrDEihk4SdZE/A4z5Dycyg9tSzDc+BnU+E0yo+tWzLc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=khnMWjpym+dZF7OBTuliUBpty+ADN96iU3cm2sj0t+D9FiLGGNM+AL5UxDPU1oCwXlFYLh1Q4cK+4n3zt+X5ekm9ockh+QzGSxl28fJkJAqLnHvUOwEjurrWTdCh/s8jF/liBS0dgo5W4C51+lHXekHlqrYzmRxymfGY4hBpTx8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Mu/dAu1A; 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="Mu/dAu1A" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72F7E1F00A3D; Thu, 16 Jul 2026 14:29:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784212196; bh=7/RuHHlSGGusb9XFr6KPqEXP+HTh4ZrC3H0cBTgV+I4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Mu/dAu1A1IsNSY+/jd9/hb5EZuti+tLz8tpFiHQKhsGaajHW2e2sn90dLFh84aJUz zo0JpS/xQEw0LvCrqzgf+SJ6N7XpT3aXn6f3LGnyGaOyyo1/mdoe1TWV3MPML9VYgJ 2eRMhFiNxThS3nCfjdKi3tVIEyqJhzE993Zl1ww4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yuho Choi , Zhongqiu Han , "Rafael J. Wysocki" Subject: [PATCH 6.12 193/349] cpufreq: pcc: fix use-after-free and double free in _OSC evaluation Date: Thu, 16 Jul 2026 15:32:07 +0200 Message-ID: <20260716133037.695776349@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260716133033.287196923@linuxfoundation.org> References: <20260716133033.287196923@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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuho Choi commit 266d3dd8b757b48a576e90f018b51f7b7563cc32 upstream. pcc_cpufreq_do_osc() calls acpi_evaluate_object() twice for the two-phase _OSC negotiation. Between the two calls it freed output.pointer but left output.length unchanged. Since acpi_evaluate_object() treats a non-zero length with a non-NULL pointer as an existing buffer to write into, the second call wrote into freed memory (use-after-free). The subsequent kfree(output.pointer) at out_free then freed the same pointer a second time (double free). Reset output.pointer to NULL and output.length to ACPI_ALLOCATE_BUFFER after freeing the first result, so ACPICA allocates a fresh buffer for each phase independently. Fixes: 0f1d683fb35d ("[CPUFREQ] Processor Clocking Control interface driver") Signed-off-by: Yuho Choi Reviewed-by: Zhongqiu Han Cc: All applicable Link: https://patch.msgid.link/20260416144621.93964-1-dbgh9129@gmail.com Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/cpufreq/pcc-cpufreq.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/cpufreq/pcc-cpufreq.c +++ b/drivers/cpufreq/pcc-cpufreq.c @@ -352,6 +352,8 @@ static int __init pcc_cpufreq_do_osc(acp } kfree(output.pointer); + output.pointer = NULL; + output.length = ACPI_ALLOCATE_BUFFER; capabilities[0] = 0x0; capabilities[1] = 0x1;