[PATCH] thermal: int340x: Fix sysfs group leak on DLVR registration failure

Subsystems: the rest, thermal

STALE250d

4 messages, 3 authors, 2026-02-11 · open the first message on its own page

[PATCH] thermal: int340x: Fix sysfs group leak on DLVR registration failure

From: Kaushlendra Kumar <hidden>
Date: 2025-12-15 05:48:11

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 <redacted>
---
 .../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
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
@@ -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

[RESEND, Cc only] RE: [PATCH] thermal: int340x: Fix sysfs group leak on DLVR registration failure

From: Kumar, Kaushlendra <hidden>
Date: 2026-02-11 08:23:18

Adding Cc: srinivas.pandruvada@linux.intel.com

No code changes.

Original patch: https://patchwork.kernel.org/project/linux-pm/patch/20251215054538.3483331-1-kaushlendra.kumar@intel.com/

-----Original Message-----
From: Kumar, Kaushlendra <redacted> 
Sent: Monday, December 15, 2025 11:16 AM
To: rafael@kernel.org; daniel.lezcano@linaro.org; Zhang, Rui <rui.zhang@intel.com>; lukasz.luba@arm.com
Cc: linux-pm@vger.kernel.org; Kumar, Kaushlendra <redacted>
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.

Signed-off-by: Kaushlendra Kumar <redacted>
---
 .../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
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
@@ -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

Re: [RESEND, Cc only] RE: [PATCH] thermal: int340x: Fix sysfs group leak on DLVR registration failure

From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
Date: 2026-02-11 19:31:58

On Wed, 2026-02-11 at 08:23 +0000, Kumar, Kaushlendra wrote:
Adding Cc: srinivas.pandruvada@linux.intel.com

No code changes.

Original patch:
https://patchwork.kernel.org/project/linux-pm/patch/20251215054538.3483331-1-kaushlendra.kumar@intel.com/

-----Original Message-----
From: Kumar, Kaushlendra <redacted> 
Sent: Monday, December 15, 2025 11:16 AM
To: rafael@kernel.org; daniel.lezcano@linaro.org; Zhang, Rui
[off-list ref]; lukasz.luba@arm.com
Cc: linux-pm@vger.kernel.org; Kumar, Kaushlendra
[off-list ref]
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.

Signed-off-by: Kaushlendra Kumar <redacted>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
quoted hunk
---
 .../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
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
@@ -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

Re: [RESEND, Cc only] RE: [PATCH] thermal: int340x: Fix sysfs group leak on DLVR registration failure

From: "Rafael J. Wysocki" <rafael@kernel.org>
Date: 2026-02-11 19:57:50

On Wed, Feb 11, 2026 at 8:32 PM srinivas pandruvada
[off-list ref] wrote:
On Wed, 2026-02-11 at 08:23 +0000, Kumar, Kaushlendra wrote:
quoted
Adding Cc: srinivas.pandruvada@linux.intel.com

No code changes.

Original patch:
https://patchwork.kernel.org/project/linux-pm/patch/20251215054538.3483331-1-kaushlendra.kumar@intel.com/

-----Original Message-----
From: Kumar, Kaushlendra <redacted>
Sent: Monday, December 15, 2025 11:16 AM
To: rafael@kernel.org; daniel.lezcano@linaro.org; Zhang, Rui
[off-list ref]; lukasz.luba@arm.com
Cc: linux-pm@vger.kernel.org; Kumar, Kaushlendra
[off-list ref]
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.

Signed-off-by: Kaushlendra Kumar <redacted>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Applied as 7.0-rc material, thanks!
quoted
---
 .../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
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help