lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250223201709.4917-1-jiashengjiangcool@gmail.com>
Date: Sun, 23 Feb 2025 20:17:09 +0000
From: Jiasheng Jiang <jiashengjiangcool@...il.com>
To: vadim.fedorenko@...ux.dev,
	arkadiusz.kubalewski@...el.com,
	jiri@...nulli.us,
	davem@...emloft.net,
	jan.glaza@...el.com,
	przemyslaw.kitszel@...el.com
Cc: netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Jiasheng Jiang <jiashengjiangcool@...il.com>,
	stable@...r.kernel.org
Subject: [PATCH] dpll: Add a check before kfree() to match the existing check before kmemdup()

When src->freq_supported is not NULL but src->freq_supported_num is 0,
dst->freq_supported is equal to src->freq_supported.
In this case, if the subsequent kstrdup() fails, src->freq_supported may
be freed without being set to NULL, potentially leading to a
use-after-free or double-free error.

Fixes: 830ead5fb0c5 ("dpll: fix pin dump crash for rebound module")
Cc: <stable@...r.kernel.org> # v6.8+
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@...il.com>
---
 drivers/dpll/dpll_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index 32019dc33cca..7d147adf8455 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -475,7 +475,8 @@ static int dpll_pin_prop_dup(const struct dpll_pin_properties *src,
 err_panel_label:
 	kfree(dst->board_label);
 err_board_label:
-	kfree(dst->freq_supported);
+	if (src->freq_supported_num)
+		kfree(dst->freq_supported);
 	return -ENOMEM;
 }
 
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ