public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue()
       [not found] <cover.1747397638.git.jani.nikula@intel.com>
@ 2025-05-16 12:16 ` Jani Nikula
  2025-05-16 14:04   ` Matthew Auld
  2025-05-16 12:16 ` [PATCH 2/7] drm/xe/display: Add check for alloc_ordered_workqueue() Jani Nikula
  1 sibling, 1 reply; 5+ messages in thread
From: Jani Nikula @ 2025-05-16 12:16 UTC (permalink / raw)
  To: intel-gfx, intel-xe; +Cc: jani.nikula, Haoxiang Li, stable

From: Haoxiang Li <haoxiang_li2024@163.com>

Add check for the return value of alloc_ordered_workqueue()
and alloc_workqueue(). Furthermore, if some allocations fail,
cleanup works are added to avoid potential memory leak problem.

Fixes: 40053823baad ("drm/i915/display: move modeset probe/remove functions to intel_display_driver.c")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 .../drm/i915/display/intel_display_driver.c   | 30 +++++++++++++++----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
index 5c74ab5fd1aa..411fe7b918a7 100644
--- a/drivers/gpu/drm/i915/display/intel_display_driver.c
+++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
@@ -244,31 +244,45 @@ int intel_display_driver_probe_noirq(struct intel_display *display)
 	intel_dmc_init(display);
 
 	display->wq.modeset = alloc_ordered_workqueue("i915_modeset", 0);
+	if (!display->wq.modeset) {
+		ret = -ENOMEM;
+		goto cleanup_vga_client_pw_domain_dmc;
+	}
+
 	display->wq.flip = alloc_workqueue("i915_flip", WQ_HIGHPRI |
 						WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE);
+	if (!display->wq.flip) {
+		ret = -ENOMEM;
+		goto cleanup_wq_modeset;
+	}
+
 	display->wq.cleanup = alloc_workqueue("i915_cleanup", WQ_HIGHPRI, 0);
+	if (!display->wq.cleanup) {
+		ret = -ENOMEM;
+		goto cleanup_wq_flip;
+	}
 
 	intel_mode_config_init(display);
 
 	ret = intel_cdclk_init(display);
 	if (ret)
-		goto cleanup_vga_client_pw_domain_dmc;
+		goto cleanup_wq_cleanup;
 
 	ret = intel_color_init(display);
 	if (ret)
-		goto cleanup_vga_client_pw_domain_dmc;
+		goto cleanup_wq_cleanup;
 
 	ret = intel_dbuf_init(display);
 	if (ret)
-		goto cleanup_vga_client_pw_domain_dmc;
+		goto cleanup_wq_cleanup;
 
 	ret = intel_bw_init(display);
 	if (ret)
-		goto cleanup_vga_client_pw_domain_dmc;
+		goto cleanup_wq_cleanup;
 
 	ret = intel_pmdemand_init(display);
 	if (ret)
-		goto cleanup_vga_client_pw_domain_dmc;
+		goto cleanup_wq_cleanup;
 
 	intel_init_quirks(display);
 
@@ -276,6 +290,12 @@ int intel_display_driver_probe_noirq(struct intel_display *display)
 
 	return 0;
 
+cleanup_wq_cleanup:
+	destroy_workqueue(display->wq.cleanup);
+cleanup_wq_flip:
+	destroy_workqueue(display->wq.flip);
+cleanup_wq_modeset:
+	destroy_workqueue(display->wq.modeset);
 cleanup_vga_client_pw_domain_dmc:
 	intel_dmc_fini(display);
 	intel_power_domains_driver_remove(display);
-- 
2.39.5


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

* [PATCH 2/7] drm/xe/display: Add check for alloc_ordered_workqueue()
       [not found] <cover.1747397638.git.jani.nikula@intel.com>
  2025-05-16 12:16 ` [PATCH 1/7] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() Jani Nikula
@ 2025-05-16 12:16 ` Jani Nikula
  2025-05-16 14:05   ` Matthew Auld
  1 sibling, 1 reply; 5+ messages in thread
From: Jani Nikula @ 2025-05-16 12:16 UTC (permalink / raw)
  To: intel-gfx, intel-xe; +Cc: jani.nikula, Haoxiang Li, stable

From: Haoxiang Li <haoxiang_li2024@163.com>

Add check for the return value of alloc_ordered_workqueue()
in xe_display_create() to catch potential exception.

Fixes: 44e694958b95 ("drm/xe/display: Implement display support")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/xe/display/xe_display.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
index 699f401eff10..df897d08255c 100644
--- a/drivers/gpu/drm/xe/display/xe_display.c
+++ b/drivers/gpu/drm/xe/display/xe_display.c
@@ -112,6 +112,8 @@ int xe_display_create(struct xe_device *xe)
 	spin_lock_init(&display->fb_tracking.lock);
 
 	display->hotplug.dp_wq = alloc_ordered_workqueue("xe-dp", 0);
+	if (!display->hotplug.dp_wq)
+		return -ENOMEM;
 
 	return drmm_add_action_or_reset(&xe->drm, display_destroy, NULL);
 }
-- 
2.39.5


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

* Re: [PATCH 1/7] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue()
  2025-05-16 12:16 ` [PATCH 1/7] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() Jani Nikula
@ 2025-05-16 14:04   ` Matthew Auld
  2025-05-20 18:10     ` Jani Nikula
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Auld @ 2025-05-16 14:04 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx, intel-xe; +Cc: Haoxiang Li, stable

On 16/05/2025 13:16, Jani Nikula wrote:
> From: Haoxiang Li <haoxiang_li2024@163.com>
> 
> Add check for the return value of alloc_ordered_workqueue()
> and alloc_workqueue(). Furthermore, if some allocations fail,
> cleanup works are added to avoid potential memory leak problem.
> 
> Fixes: 40053823baad ("drm/i915/display: move modeset probe/remove functions to intel_display_driver.c")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Matthew Auld <matthew.auld@intel.com>

> ---
>   .../drm/i915/display/intel_display_driver.c   | 30 +++++++++++++++----
>   1 file changed, 25 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
> index 5c74ab5fd1aa..411fe7b918a7 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_driver.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
> @@ -244,31 +244,45 @@ int intel_display_driver_probe_noirq(struct intel_display *display)
>   	intel_dmc_init(display);
>   
>   	display->wq.modeset = alloc_ordered_workqueue("i915_modeset", 0);
> +	if (!display->wq.modeset) {
> +		ret = -ENOMEM;
> +		goto cleanup_vga_client_pw_domain_dmc;
> +	}
> +
>   	display->wq.flip = alloc_workqueue("i915_flip", WQ_HIGHPRI |
>   						WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE);
> +	if (!display->wq.flip) {
> +		ret = -ENOMEM;
> +		goto cleanup_wq_modeset;
> +	}
> +
>   	display->wq.cleanup = alloc_workqueue("i915_cleanup", WQ_HIGHPRI, 0);
> +	if (!display->wq.cleanup) {
> +		ret = -ENOMEM;
> +		goto cleanup_wq_flip;
> +	}
>   
>   	intel_mode_config_init(display);
>   
>   	ret = intel_cdclk_init(display);
>   	if (ret)
> -		goto cleanup_vga_client_pw_domain_dmc;
> +		goto cleanup_wq_cleanup;
>   
>   	ret = intel_color_init(display);
>   	if (ret)
> -		goto cleanup_vga_client_pw_domain_dmc;
> +		goto cleanup_wq_cleanup;
>   
>   	ret = intel_dbuf_init(display);
>   	if (ret)
> -		goto cleanup_vga_client_pw_domain_dmc;
> +		goto cleanup_wq_cleanup;
>   
>   	ret = intel_bw_init(display);
>   	if (ret)
> -		goto cleanup_vga_client_pw_domain_dmc;
> +		goto cleanup_wq_cleanup;
>   
>   	ret = intel_pmdemand_init(display);
>   	if (ret)
> -		goto cleanup_vga_client_pw_domain_dmc;
> +		goto cleanup_wq_cleanup;
>   
>   	intel_init_quirks(display);
>   
> @@ -276,6 +290,12 @@ int intel_display_driver_probe_noirq(struct intel_display *display)
>   
>   	return 0;
>   
> +cleanup_wq_cleanup:
> +	destroy_workqueue(display->wq.cleanup);
> +cleanup_wq_flip:
> +	destroy_workqueue(display->wq.flip);
> +cleanup_wq_modeset:
> +	destroy_workqueue(display->wq.modeset);
>   cleanup_vga_client_pw_domain_dmc:
>   	intel_dmc_fini(display);
>   	intel_power_domains_driver_remove(display);


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

* Re: [PATCH 2/7] drm/xe/display: Add check for alloc_ordered_workqueue()
  2025-05-16 12:16 ` [PATCH 2/7] drm/xe/display: Add check for alloc_ordered_workqueue() Jani Nikula
@ 2025-05-16 14:05   ` Matthew Auld
  0 siblings, 0 replies; 5+ messages in thread
From: Matthew Auld @ 2025-05-16 14:05 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx, intel-xe; +Cc: Haoxiang Li, stable

On 16/05/2025 13:16, Jani Nikula wrote:
> From: Haoxiang Li <haoxiang_li2024@163.com>
> 
> Add check for the return value of alloc_ordered_workqueue()
> in xe_display_create() to catch potential exception.
> 
> Fixes: 44e694958b95 ("drm/xe/display: Implement display support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Matthew Auld <matthew.auld@intel.com>

> ---
>   drivers/gpu/drm/xe/display/xe_display.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
> index 699f401eff10..df897d08255c 100644
> --- a/drivers/gpu/drm/xe/display/xe_display.c
> +++ b/drivers/gpu/drm/xe/display/xe_display.c
> @@ -112,6 +112,8 @@ int xe_display_create(struct xe_device *xe)
>   	spin_lock_init(&display->fb_tracking.lock);
>   
>   	display->hotplug.dp_wq = alloc_ordered_workqueue("xe-dp", 0);
> +	if (!display->hotplug.dp_wq)
> +		return -ENOMEM;
>   
>   	return drmm_add_action_or_reset(&xe->drm, display_destroy, NULL);
>   }


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

* Re: [PATCH 1/7] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue()
  2025-05-16 14:04   ` Matthew Auld
@ 2025-05-20 18:10     ` Jani Nikula
  0 siblings, 0 replies; 5+ messages in thread
From: Jani Nikula @ 2025-05-20 18:10 UTC (permalink / raw)
  To: Matthew Auld, intel-gfx, intel-xe; +Cc: Haoxiang Li, stable

On Fri, 16 May 2025, Matthew Auld <matthew.auld@intel.com> wrote:
> On 16/05/2025 13:16, Jani Nikula wrote:
>> From: Haoxiang Li <haoxiang_li2024@163.com>
>> 
>> Add check for the return value of alloc_ordered_workqueue()
>> and alloc_workqueue(). Furthermore, if some allocations fail,
>> cleanup works are added to avoid potential memory leak problem.
>> 
>> Fixes: 40053823baad ("drm/i915/display: move modeset probe/remove functions to intel_display_driver.c")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>

Thanks for the review, pushed the lot to drm-intel-next.

BR,
Jani.


-- 
Jani Nikula, Intel

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

end of thread, other threads:[~2025-05-20 18:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1747397638.git.jani.nikula@intel.com>
2025-05-16 12:16 ` [PATCH 1/7] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() Jani Nikula
2025-05-16 14:04   ` Matthew Auld
2025-05-20 18:10     ` Jani Nikula
2025-05-16 12:16 ` [PATCH 2/7] drm/xe/display: Add check for alloc_ordered_workqueue() Jani Nikula
2025-05-16 14:05   ` Matthew Auld

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