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: <20250901064512.1554-1-hanchunchao@inspur.com>
Date: Mon, 1 Sep 2025 14:45:11 +0800
From: Charles Han <hanchunchao@...pur.com>
To: <marius.cristea@...rochip.com>, <jic23@...nel.org>,
	<dlechner@...libre.com>, <nuno.sa@...log.com>, <andy@...nel.org>
CC: <linux-iio@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Charles Han
	<hanchunchao@...pur.com>
Subject: [PATCH] iio: adc: Fix a null pointer dereference in pac1934_acpi_parse_channel_config

Add check for the return value of devm_kmemdup()
to prevent potential null pointer dereference.

Fixes: 0fb528c8255b ("iio: adc: adding support for PAC193x")
Signed-off-by: Charles Han <hanchunchao@...pur.com>
---
 drivers/iio/adc/pac1934.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/adc/pac1934.c b/drivers/iio/adc/pac1934.c
index 2e442e46f679..95c9d14b5529 100644
--- a/drivers/iio/adc/pac1934.c
+++ b/drivers/iio/adc/pac1934.c
@@ -1108,6 +1108,9 @@ static int pac1934_acpi_parse_channel_config(struct i2c_client *client,
 			devm_kmemdup(dev, rez->package.elements[i].string.pointer,
 				     (size_t)rez->package.elements[i].string.length + 1,
 				     GFP_KERNEL);
+		if (!info->labels[idx])
+			return -ENOMEM;
+
 		info->labels[idx][rez->package.elements[i].string.length] = '\0';
 		info->shunts[idx] = rez->package.elements[i + 1].integer.value * 1000;
 		info->active_channels[idx] = (info->shunts[idx] != 0);
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ