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:
 <SYBPR01MB7881BB1354955C1608A16502AFA8A@SYBPR01MB7881.ausprd01.prod.outlook.com>
Date: Thu, 18 Dec 2025 15:56:47 +0800
From: Junrui Luo <moonafterrain@...look.com>
To: Guenter Roeck <linux@...ck-us.net>, 
 "Darrick J. Wong" <djwong@...ibm.com>, 
 "Mark M. Hoffman" <mhoffman@...htlink.com>
Cc: linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org, 
 Yuhao Jiang <danisjiang@...il.com>, Junrui Luo <moonafterrain@...look.com>, 
 stable@...r.kernel.org
Subject: [PATCH] hwmon: (ibmpex) Fix use-after-free in sysfs removal

There is a use-after-free vulnerability in the ibmpex driver where
the driver frees the sensors array while sysfs read operations
via ibmpex_show_sensor() are still in progress.

Fix this by reordering cleanup operations in ibmpex_bmc_delete().

Reported-by: Yuhao Jiang <danisjiang@...il.com>
Reported-by: Junrui Luo <moonafterrain@...look.com>
Fixes: 57c7c3a0fdea ("hwmon: IBM power meter driver")
Cc: stable@...r.kernel.org
Signed-off-by: Junrui Luo <moonafterrain@...look.com>
---
 drivers/hwmon/ibmpex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c
index 228c5f6c6f38..578549f44154 100644
--- a/drivers/hwmon/ibmpex.c
+++ b/drivers/hwmon/ibmpex.c
@@ -508,6 +508,7 @@ static void ibmpex_bmc_delete(struct ibmpex_bmc_data *data)
 {
 	int i, j;
 
+	hwmon_device_unregister(data->hwmon_dev);
 	device_remove_file(data->bmc_device,
 			   &sensor_dev_attr_reset_high_low.dev_attr);
 	device_remove_file(data->bmc_device, &dev_attr_name.attr);
@@ -522,7 +523,6 @@ static void ibmpex_bmc_delete(struct ibmpex_bmc_data *data)
 
 	list_del(&data->list);
 	dev_set_drvdata(data->bmc_device, NULL);
-	hwmon_device_unregister(data->hwmon_dev);
 	ipmi_destroy_user(data->user);
 	kfree(data->sensors);
 	kfree(data);

---
base-commit: cfd4039213e7b5a828c5b78e1b5235cac91af53d
change-id: 20251218-fixes-25f078f93a1c

Best regards,
-- 
Junrui Luo <moonafterrain@...look.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ