dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/panthor: validate group queue count
@ 2025-09-02 19:20 Chia-I Wu
  2025-09-03  7:38 ` Boris Brezillon
  2025-09-03 11:37 ` Steven Price
  0 siblings, 2 replies; 3+ messages in thread
From: Chia-I Wu @ 2025-09-02 19:20 UTC (permalink / raw)
  To: Boris Brezillon, Steven Price, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	dri-devel, linux-kernel

A panthor group can have at most MAX_CS_PER_CSG panthor queues.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
---
 drivers/gpu/drm/panthor/panthor_sched.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
index ba5dc3e443d9c..249ab889ca91f 100644
--- a/drivers/gpu/drm/panthor/panthor_sched.c
+++ b/drivers/gpu/drm/panthor/panthor_sched.c
@@ -3473,6 +3473,9 @@ int panthor_group_create(struct panthor_file *pfile,
 	    hweight64(group_args->tiler_core_mask) < group_args->max_tiler_cores)
 		return -EINVAL;
 
+	if (group_args->queues.count > MAX_CS_PER_CSG)
+		return -EINVAL;
+
 	group = kzalloc(sizeof(*group), GFP_KERNEL);
 	if (!group)
 		return -ENOMEM;
-- 
2.51.0.338.gd7d06c2dae-goog


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

* Re: [PATCH] drm/panthor: validate group queue count
  2025-09-02 19:20 [PATCH] drm/panthor: validate group queue count Chia-I Wu
@ 2025-09-03  7:38 ` Boris Brezillon
  2025-09-03 11:37 ` Steven Price
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2025-09-03  7:38 UTC (permalink / raw)
  To: Chia-I Wu
  Cc: Steven Price, Liviu Dudau, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
	linux-kernel

On Tue,  2 Sep 2025 12:20:01 -0700
Chia-I Wu <olvaffe@gmail.com> wrote:

> A panthor group can have at most MAX_CS_PER_CSG panthor queues.
> 
> Signed-off-by: Chia-I Wu <olvaffe@gmail.com>

With a proper Fixes tag, this is

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>

> ---
>  drivers/gpu/drm/panthor/panthor_sched.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index ba5dc3e443d9c..249ab889ca91f 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -3473,6 +3473,9 @@ int panthor_group_create(struct panthor_file *pfile,
>  	    hweight64(group_args->tiler_core_mask) < group_args->max_tiler_cores)
>  		return -EINVAL;
>  
> +	if (group_args->queues.count > MAX_CS_PER_CSG)
> +		return -EINVAL;
> +
>  	group = kzalloc(sizeof(*group), GFP_KERNEL);
>  	if (!group)
>  		return -ENOMEM;


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

* Re: [PATCH] drm/panthor: validate group queue count
  2025-09-02 19:20 [PATCH] drm/panthor: validate group queue count Chia-I Wu
  2025-09-03  7:38 ` Boris Brezillon
@ 2025-09-03 11:37 ` Steven Price
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Price @ 2025-09-03 11:37 UTC (permalink / raw)
  To: Chia-I Wu, Boris Brezillon, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	dri-devel, linux-kernel

On 02/09/2025 20:20, Chia-I Wu wrote:
> A panthor group can have at most MAX_CS_PER_CSG panthor queues.
> 
> Signed-off-by: Chia-I Wu <olvaffe@gmail.com>

Good catch - that's a nasty bug.

I think this should have:

Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block")

> ---
>  drivers/gpu/drm/panthor/panthor_sched.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index ba5dc3e443d9c..249ab889ca91f 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -3473,6 +3473,9 @@ int panthor_group_create(struct panthor_file *pfile,
>  	    hweight64(group_args->tiler_core_mask) < group_args->max_tiler_cores)
>  		return -EINVAL;
>  
> +	if (group_args->queues.count > MAX_CS_PER_CSG)
> +		return -EINVAL;
> +

I think this check would be better moved up to
panthor_ioctl_group_create() (where we already have a zero check). But
either way:

Reviewed-by: Steven Price <steven.price@arm.com>

Thanks,
Steve

>  	group = kzalloc(sizeof(*group), GFP_KERNEL);
>  	if (!group)
>  		return -ENOMEM;


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

end of thread, other threads:[~2025-09-03 11:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-02 19:20 [PATCH] drm/panthor: validate group queue count Chia-I Wu
2025-09-03  7:38 ` Boris Brezillon
2025-09-03 11:37 ` Steven Price

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).