]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
thermal: int340x: Fix sysfs group leak on DLVR registration failure
authorKaushlendra Kumar <kaushlendra.kumar@intel.com>
Wed, 11 Feb 2026 08:23:15 +0000 (08:23 +0000)
committerSasha Levin <sashal@kernel.org>
Wed, 4 Mar 2026 12:20:45 +0000 (07:20 -0500)
[ Upstream commit 15176b818e048ccf6ef4b96db34eda7b7e98938a ]

When DLVR sysfs group creation fails in proc_thermal_rfim_add(),
the function returns immediately without cleaning up the FIVR group
that may have been created earlier.

Add proper error unwinding to remove the FIVR group before returning
failure.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://patch.msgid.link/LV3PR11MB876881B77D32A2854AD2908EF563A@LV3PR11MB8768.namprd11.prod.outlook.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c

index 589a3a71f0c4c12d1f1f52f4fd58234e9cbd4082..ba88d878c998da285ecbc2ddaa98340eb24b2275 100644 (file)
@@ -466,8 +466,11 @@ int proc_thermal_rfim_add(struct pci_dev *pdev, struct proc_thermal_device *proc
                        break;
                }
                ret = sysfs_create_group(&pdev->dev.kobj, &dlvr_attribute_group);
-               if (ret)
+               if (ret) {
+                       if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_FIVR)
+                               sysfs_remove_group(&pdev->dev.kobj, &fivr_attribute_group);
                        return ret;
+               }
        }
 
        if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_DVFS) {