Skip to contentSkip to conversation

thermal: int340x: Fix sysfs group leak on DLVR registration failure

PATCH Applied Kaushlendra Kumar 3 participants 4 messages Dec 15, 2025 – Feb 11 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: int340x: Fix sysfs group leak on DLVR registration failure

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.

---
 .../thermal/intel/int340x_thermal/processor_thermal_rfim.c   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c +4 -1
index 589a3a71f0c4..ba88d878c998 100644
@@ -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) {
Signature · 1 line
2.34.1
#1 lore raw

Adding Cc: [email protected]

No code changes.

Original patch: https://patchwork.kernel.org/project/linux-pm/patch/[email protected]/

-----Original Message-----
From: Kumar, Kaushlendra <[email protected]>
Sent: Monday, December 15, 2025 11:16 AM
To: [email protected]; [email protected]; Zhang, Rui <[email protected]>; [email protected]
Cc: [email protected]; Kumar, Kaushlendra <[email protected]>
Subject: [PATCH] thermal: int340x: Fix sysfs group leak on DLVR registration failure

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.

---
 .../thermal/intel/int340x_thermal/processor_thermal_rfim.c   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c +4 -1
index 589a3a71f0c4..ba88d878c998 100644
@@ -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) {

--
2.34.1

#2 lore raw
Quoted 17 lines · Kaushlendra

Adding Cc: [email protected]

No code changes.

Original patch:
https://patchwork.kernel.org/project/linux-pm/patch/[email protected]/

-----Original Message-----
From: Kumar, Kaushlendra <[email protected]>
Sent: Monday, December 15, 2025 11:16 AM
To: [email protected]; [email protected]; Zhang, Rui <[email protected]>; [email protected]
Cc: [email protected]; Kumar, Kaushlendra <[email protected]>
Subject: [PATCH] thermal: int340x: Fix sysfs group leak on DLVR registration failure

Quoted 8 lines

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.

Quoted 31 lines

---
 .../thermal/intel/int340x_thermal/processor_thermal_rfim.c   | 5
++++-

 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c index 589a3a71f0c4..ba88d878c998 100644

drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c +0 -0
@@ -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);

drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c +2 -1
-		if (ret)
+		if (ret) {
+			if (proc_priv->mmio_feature_mask &

PROC_THERMAL_FEATURE_FIVR)

drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c +1 -0
+				sysfs_remove_group(&pdev->dev.kobj,

&fivr_attribute_group);
  return ret;

drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c +1 -0
+		}

  }

  if (proc_priv->mmio_feature_mask &
PROC_THERMAL_FEATURE_DVFS) {
--
2.34.1

maintainer Applied
#3 lore raw
Quoted 23 lines · srinivas pandruvada
Quoted 21 lines · Kaushlendra

Adding Cc: [email protected]

No code changes.

Original patch:
https://patchwork.kernel.org/project/linux-pm/patch/[email protected]/

-----Original Message-----
From: Kumar, Kaushlendra <[email protected]>
Sent: Monday, December 15, 2025 11:16 AM
To: [email protected]; [email protected]; Zhang, Rui <[email protected]>; [email protected]
Cc: [email protected]; Kumar, Kaushlendra <[email protected]>
Subject: [PATCH] thermal: int340x: Fix sysfs group leak on DLVR registration failure

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.

Quoted 6 lines
Quoted 4 lines

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

Applied as 7.0-rc material, thanks!

Quoted 32 lines
Quoted 31 lines
---
 .../thermal/intel/int340x_thermal/processor_thermal_rfim.c   | 5
++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c index 589a3a71f0c4..ba88d878c998 100644

drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c +0 -0
@@ -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);

drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c +2 -1
-             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) {
--
2.34.1