Skip to content

Commit e2a8778

Browse files
gscuigroeck
authored andcommitted
hwmon: (ibmpex) Fix possible UAF when ibmpex_register_bmc() fails
Smatch report warning as follows: drivers/hwmon/ibmpex.c:509 ibmpex_register_bmc() warn: '&data->list' not removed from list If ibmpex_find_sensors() fails in ibmpex_register_bmc(), data will be freed, but data->list will not be removed from driver_data.bmc_data, then list traversal may cause UAF. Fix by removeing it from driver_data.bmc_data before free(). Fixes: 57c7c3a ("hwmon: IBM power meter driver") Signed-off-by: Gaosheng Cui <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 3b7f98f commit e2a8778

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/hwmon/ibmpex.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ static void ibmpex_register_bmc(int iface, struct device *dev)
502502
return;
503503

504504
out_register:
505+
list_del(&data->list);
505506
hwmon_device_unregister(data->hwmon_dev);
506507
out_user:
507508
ipmi_destroy_user(data->user);

0 commit comments

Comments
 (0)