thermal: int340x: Fix sysfs group leak on DLVR registration failure
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
@@ -466,8 +466,11 @@ int proc_thermal_rfim_add(struct pci_dev *pdev, struct proc_thermal_device *procbreak ; } 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
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
@@ -466,8 +466,11 @@ int proc_thermal_rfim_add(struct pci_dev *pdev, struct proc_thermal_device *procbreak ; } 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
srinivas pandruvada
Acked-byQuoted 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.
Signed-off-by Kaushlendra Kumar <[email protected]>
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.cb/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.cindex589a3a71f0c4..ba88d878c998100644drivers/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
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 failureWhen 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.
Signed-off-by Kaushlendra Kumar <[email protected]>
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.cb/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.cindex589a3a71f0c4..ba88d878c998100644drivers/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*procbreak; } 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