mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] serial: qcom-geni: Avoid double-free of PM domain list
@ 2026-09-01  9:50 Aniket Randive
  2026-09-01  9:53 ` Praveen Talari
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Aniket Randive @ 2026-09-01  9:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: konrad.dybcio, naresh.maramaina, praveen.talari, linux-arm-msm,
	linux-kernel, linux-serial, Aniket Randive

The SA8255P UART variants attach PM domains through
devm_pm_domain_attach_list(), which registers a devres cleanup action
to detach and free the PM domain list automatically on probe failure
or device removal.

Remove the manual dev_pm_domain_detach_list() calls from the probe
error path and remove callback. These calls can operate on memory
that has already been freed by the devres-managed cleanup, resulting
in a potential double-free. Also remove the unused pm_domain.h header.

Suggested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Aniket Randive <aniket.randive@oss.qualcomm.com>
---
 drivers/tty/serial/qcom_geni_serial.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 3633723acef8..fe961b206645 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -20,7 +20,6 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/panic_notifier.h>
-#include <linux/pm_domain.h>
 #include <linux/pm_opp.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
@@ -2008,7 +2007,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
 				 DMA_RX_BUF_SIZE, DMA_FROM_DEVICE);
 		port->rx_dma_addr = 0;
 	}
-	dev_pm_domain_detach_list(port->se.pd_list);
 	return ret;
 }
 
@@ -2032,8 +2030,6 @@ static void qcom_geni_serial_remove(struct platform_device *pdev)
 				 DMA_RX_BUF_SIZE, DMA_FROM_DEVICE);
 		port->rx_dma_addr = 0;
 	}
-
-	dev_pm_domain_detach_list(port->se.pd_list);
 }
 
 static int __maybe_unused qcom_geni_serial_runtime_suspend(struct device *dev)

---
base-commit: 89c07d98716a13454ec3fd9f97689e812cc71bd4
change-id: 20260901-probe_cleanup_uart-60bb7d0df5ae

Best regards,
--  
Aniket Randive <aniket.randive@oss.qualcomm.com>


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

* Re: [PATCH v1] serial: qcom-geni: Avoid double-free of PM domain list
  2026-09-01  9:50 [PATCH v1] serial: qcom-geni: Avoid double-free of PM domain list Aniket Randive
@ 2026-09-01  9:53 ` Praveen Talari
  2026-09-01  9:54 ` Konrad Dybcio
  2026-09-01 14:52 ` Abel Vesa
  2 siblings, 0 replies; 4+ messages in thread
From: Praveen Talari @ 2026-09-01  9:53 UTC (permalink / raw)
  To: Aniket Randive, Greg Kroah-Hartman, Jiri Slaby
  Cc: konrad.dybcio, naresh.maramaina, linux-arm-msm, linux-kernel,
	linux-serial

Hi

On 01-09-2026 15:20, Aniket Randive wrote:
> The SA8255P UART variants attach PM domains through
> devm_pm_domain_attach_list(), which registers a devres cleanup action
> to detach and free the PM domain list automatically on probe failure
> or device removal.
>
> Remove the manual dev_pm_domain_detach_list() calls from the probe
> error path and remove callback. These calls can operate on memory
> that has already been freed by the devres-managed cleanup, resulting
> in a potential double-free. Also remove the unused pm_domain.h header.
>
> Suggested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> Signed-off-by: Aniket Randive <aniket.randive@oss.qualcomm.com>
> ---
>   drivers/tty/serial/qcom_geni_serial.c | 4 ----
>   1 file changed, 4 deletions(-)
>
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index 3633723acef8..fe961b206645 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -20,7 +20,6 @@
>   #include <linux/module.h>
>   #include <linux/of.h>
>   #include <linux/panic_notifier.h>
> -#include <linux/pm_domain.h>
>   #include <linux/pm_opp.h>
>   #include <linux/platform_device.h>
>   #include <linux/pm_runtime.h>
> @@ -2008,7 +2007,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
>   				 DMA_RX_BUF_SIZE, DMA_FROM_DEVICE);
>   		port->rx_dma_addr = 0;
>   	}
> -	dev_pm_domain_detach_list(port->se.pd_list);
>   	return ret;
>   }
>   
> @@ -2032,8 +2030,6 @@ static void qcom_geni_serial_remove(struct platform_device *pdev)
>   				 DMA_RX_BUF_SIZE, DMA_FROM_DEVICE);
>   		port->rx_dma_addr = 0;
>   	}
> -
> -	dev_pm_domain_detach_list(port->se.pd_list);
>   }
>   

Reviewed-by: Praveen Talari <praveen.talari@oss.qualcomm.com>

Thanks,

Praveen Talari

>   static int __maybe_unused qcom_geni_serial_runtime_suspend(struct device *dev)
>
> ---
> base-commit: 89c07d98716a13454ec3fd9f97689e812cc71bd4
> change-id: 20260901-probe_cleanup_uart-60bb7d0df5ae
>
> Best regards,
> --
> Aniket Randive <aniket.randive@oss.qualcomm.com>
>

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

* Re: [PATCH v1] serial: qcom-geni: Avoid double-free of PM domain list
  2026-09-01  9:50 [PATCH v1] serial: qcom-geni: Avoid double-free of PM domain list Aniket Randive
  2026-09-01  9:53 ` Praveen Talari
@ 2026-09-01  9:54 ` Konrad Dybcio
  2026-09-01 14:52 ` Abel Vesa
  2 siblings, 0 replies; 4+ messages in thread
From: Konrad Dybcio @ 2026-09-01  9:54 UTC (permalink / raw)
  To: Aniket Randive, Greg Kroah-Hartman, Jiri Slaby
  Cc: naresh.maramaina, praveen.talari, linux-arm-msm, linux-kernel,
	linux-serial

On 9/1/26 11:50 AM, Aniket Randive wrote:
> The SA8255P UART variants attach PM domains through
> devm_pm_domain_attach_list(), which registers a devres cleanup action
> to detach and free the PM domain list automatically on probe failure
> or device removal.
> 
> Remove the manual dev_pm_domain_detach_list() calls from the probe
> error path and remove callback. These calls can operate on memory
> that has already been freed by the devres-managed cleanup, resulting
> in a potential double-free. Also remove the unused pm_domain.h header.
> 
> Suggested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> Signed-off-by: Aniket Randive <aniket.randive@oss.qualcomm.com>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

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

* Re: [PATCH v1] serial: qcom-geni: Avoid double-free of PM domain list
  2026-09-01  9:50 [PATCH v1] serial: qcom-geni: Avoid double-free of PM domain list Aniket Randive
  2026-09-01  9:53 ` Praveen Talari
  2026-09-01  9:54 ` Konrad Dybcio
@ 2026-09-01 14:52 ` Abel Vesa
  2 siblings, 0 replies; 4+ messages in thread
From: Abel Vesa @ 2026-09-01 14:52 UTC (permalink / raw)
  To: Aniket Randive
  Cc: Greg Kroah-Hartman, Jiri Slaby, konrad.dybcio, naresh.maramaina,
	praveen.talari, linux-arm-msm, linux-kernel, linux-serial

On 26-09-01 15:20:54, Aniket Randive wrote:
> The SA8255P UART variants attach PM domains through
> devm_pm_domain_attach_list(), which registers a devres cleanup action
> to detach and free the PM domain list automatically on probe failure
> or device removal.
> 
> Remove the manual dev_pm_domain_detach_list() calls from the probe
> error path and remove callback. These calls can operate on memory
> that has already been freed by the devres-managed cleanup, resulting
> in a potential double-free. Also remove the unused pm_domain.h header.
> 
> Suggested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> Signed-off-by: Aniket Randive <aniket.randive@oss.qualcomm.com>

Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>

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

end of thread, other threads:[~2026-09-01 14:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-01  9:50 [PATCH v1] serial: qcom-geni: Avoid double-free of PM domain list Aniket Randive
2026-09-01  9:53 ` Praveen Talari
2026-09-01  9:54 ` Konrad Dybcio
2026-09-01 14:52 ` Abel Vesa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®