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 3995C34DCE4; Tue, 21 Jul 2026 22:35: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=1784673358; cv=none; b=jOgD/0PMXcXxUl9ZQU85gh8vhUQGMLiKUkt1XnxDzT+WwnflEtx6v/jk7g8cNbTbG2DW/rgxmKIT/stSa+CTutDrgGgwcFAjy+qSA3JQjhTGMsns5YplLkOu3EfwR7woaVe9VLss/4wbN0tA5wlIoPWwQ2l1lNRb/c+AuwEeFhI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784673358; c=relaxed/simple; bh=OYMLMlaiYXPWuNuRyt9Gyf+LKGqu2RFeOVGSnlxStQw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tInfRbTl8ISMqGihyZnzcqEltyPijzp+Uwxxok1wKeI+ssfcLzAc7GD7K7Ep9C8l749n3j56da5acL0m8H17PW3VITeEBFvORL/48qfEkDPo7FvwPLQGr00r4+h/dzTuEQLlOPTK9jTC6sAnyz7JqF9OqeqpU91bVSxide6AX8k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=k87+mcig; 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="k87+mcig" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A00891F000E9; Tue, 21 Jul 2026 22:35:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784673357; bh=JzKkkQZJ3befebmUOQntqjwgcTliutlmZAcbR8uF0YM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=k87+mcigr8hH3VPK+a0ka4PWyGSTOjBt8uuKnUz0KuFlXy2GIyLNhUFVCpvC0flBQ fBzB/uzljqUsZk/zM9HJWNnELD7UZeZ4MitC37sFoLOQWE6Ixc8IEKp7iisBb8Qf4Q fmEVeRL6jfLB+XP9g3YOav6N+lLgI/Be8N9VlmcU= 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 5.10 089/699] cpufreq: pcc: fix use-after-free and double free in _OSC evaluation Date: Tue, 21 Jul 2026 17:17:28 +0200 Message-ID: <20260721152357.710298327@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152355.667394603@linuxfoundation.org> References: <20260721152355.667394603@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.10-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 @@ -351,6 +351,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;