All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] platform/x86: ishtp_eclite: Fix ACPI device reference leak in probe error path
@ 2026-06-23  1:05 Ma Ke
  2026-06-23  1:23 ` srinivas pandruvada
  0 siblings, 1 reply; 2+ messages in thread
From: Ma Ke @ 2026-06-23  1:05 UTC (permalink / raw)
  To: srinivas.pandruvada, hansg, ilpo.jarvinen, sumesh.k.naduvalath,
	mgross
  Cc: platform-driver-x86, linux-kernel, akpm, Ma Ke, stable

ecl_ishtp_cl_probe() acquires a reference to an ACPI device via
acpi_find_eclite_device() but fails to release it in the error path
when acpi_opregion_init() fails. This results in a reference count
leak, preventing proper cleanup of the ACPI device.

Calling path: acpi_find_eclite_device() ->
acpi_dev_get_first_match_dev() -> acpi_dev_get_next_match_dev() ->
bus_find_device() -> get_device().

Found by code review.

Signed-off-by: Ma Ke <make_ruc2021@163.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: stable@vger.kernel.org
Fixes: 7b6bf51de974 ("platform/x86: Add Intel ishtp eclite driver")
---
 drivers/platform/x86/intel/ishtp_eclite.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel/ishtp_eclite.c b/drivers/platform/x86/intel/ishtp_eclite.c
index 93ac8b2dbf38..bca7e217878b 100644
--- a/drivers/platform/x86/intel/ishtp_eclite.c
+++ b/drivers/platform/x86/intel/ishtp_eclite.c
@@ -600,13 +600,16 @@ static int ecl_ishtp_cl_probe(struct ishtp_cl_device *cl_device)
 	rv = acpi_opregion_init(opr_dev);
 	if (rv) {
 		dev_err(cl_data_to_dev(opr_dev), "ACPI opregion init failed\n");
-		goto err_exit;
+		goto err_put;
 	}
 
 	/* Reprobe devices depending on ECLite - battery, fan, etc. */
 	acpi_dev_clear_dependencies(opr_dev->adev);
 
 	return 0;
+
+err_put:
+	acpi_dev_put(opr_dev->adev);
 err_exit:
 	ishtp_set_connection_state(ecl_ishtp_cl, ISHTP_CL_DISCONNECTING);
 	ishtp_cl_disconnect(ecl_ishtp_cl);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] platform/x86: ishtp_eclite: Fix ACPI device reference leak in probe error path
  2026-06-23  1:05 [PATCH v2] platform/x86: ishtp_eclite: Fix ACPI device reference leak in probe error path Ma Ke
@ 2026-06-23  1:23 ` srinivas pandruvada
  0 siblings, 0 replies; 2+ messages in thread
From: srinivas pandruvada @ 2026-06-23  1:23 UTC (permalink / raw)
  To: Ma Ke, hansg, ilpo.jarvinen, sumesh.k.naduvalath, mgross
  Cc: platform-driver-x86, linux-kernel, akpm, stable

On Tue, 2026-06-23 at 09:05 +0800, Ma Ke wrote:
> ecl_ishtp_cl_probe() acquires a reference to an ACPI device via
> acpi_find_eclite_device() but fails to release it in the error path
> when acpi_opregion_init() fails. This results in a reference count
> leak, preventing proper cleanup of the ACPI device.
> 
> Calling path: acpi_find_eclite_device() ->
> acpi_dev_get_first_match_dev() -> acpi_dev_get_next_match_dev() ->
> bus_find_device() -> get_device().
> 
> Found by code review.
> 
> Signed-off-by: Ma Ke <make_ruc2021@163.com>
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: stable@vger.kernel.org
> Fixes: 7b6bf51de974 ("platform/x86: Add Intel ishtp eclite driver")
> ---
Whenever you post a new version, you should add change log here,
showing what is the new in this version.

But here I think you only capitalized the first letter for "Fix".

Thanks,
Srinivas


>  drivers/platform/x86/intel/ishtp_eclite.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/intel/ishtp_eclite.c
> b/drivers/platform/x86/intel/ishtp_eclite.c
> index 93ac8b2dbf38..bca7e217878b 100644
> --- a/drivers/platform/x86/intel/ishtp_eclite.c
> +++ b/drivers/platform/x86/intel/ishtp_eclite.c
> @@ -600,13 +600,16 @@ static int ecl_ishtp_cl_probe(struct
> ishtp_cl_device *cl_device)
>  	rv = acpi_opregion_init(opr_dev);
>  	if (rv) {
>  		dev_err(cl_data_to_dev(opr_dev), "ACPI opregion init
> failed\n");
> -		goto err_exit;
> +		goto err_put;
>  	}
>  
>  	/* Reprobe devices depending on ECLite - battery, fan, etc.
> */
>  	acpi_dev_clear_dependencies(opr_dev->adev);
>  
>  	return 0;
> +
> +err_put:
> +	acpi_dev_put(opr_dev->adev);
>  err_exit:
>  	ishtp_set_connection_state(ecl_ishtp_cl,
> ISHTP_CL_DISCONNECTING);
>  	ishtp_cl_disconnect(ecl_ishtp_cl);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-23  1:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23  1:05 [PATCH v2] platform/x86: ishtp_eclite: Fix ACPI device reference leak in probe error path Ma Ke
2026-06-23  1:23 ` srinivas pandruvada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.