public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: fix a potential double free in pqm_create_queue
@ 2023-03-08  0:19 Chia-I Wu
  2023-03-08 17:42 ` Felix Kuehling
  0 siblings, 1 reply; 2+ messages in thread
From: Chia-I Wu @ 2023-03-08  0:19 UTC (permalink / raw)
  To: dri-devel
  Cc: Felix Kuehling, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, amd-gfx, linux-kernel

Set *q to NULL on errors, otherwise pqm_create_queue would free it
again.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
index 5137476ec18e6..4236539d9f932 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -218,8 +218,8 @@ static int init_user_queue(struct process_queue_manager *pqm,
 	return 0;
 
 cleanup:
-	if (dev->shared_resources.enable_mes)
-		uninit_queue(*q);
+	uninit_queue(*q);
+	*q = NULL;
 	return retval;
 }
 
-- 
2.40.0.rc0.216.gc4246ad0f0-goog


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

* Re: [PATCH] drm/amdkfd: fix a potential double free in pqm_create_queue
  2023-03-08  0:19 [PATCH] drm/amdkfd: fix a potential double free in pqm_create_queue Chia-I Wu
@ 2023-03-08 17:42 ` Felix Kuehling
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Kuehling @ 2023-03-08 17:42 UTC (permalink / raw)
  To: Chia-I Wu, dri-devel
  Cc: Alex Deucher, Christian König, Pan, Xinhui, David Airlie,
	Daniel Vetter, amd-gfx, linux-kernel

On 2023-03-07 19:19, Chia-I Wu wrote:
> Set *q to NULL on errors, otherwise pqm_create_queue would free it
> again.
>
> Signed-off-by: Chia-I Wu <olvaffe@gmail.com>

Thank you! I'm applying this patch to amd-staging-drm-next.

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>


> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> index 5137476ec18e6..4236539d9f932 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> @@ -218,8 +218,8 @@ static int init_user_queue(struct process_queue_manager *pqm,
>   	return 0;
>   
>   cleanup:
> -	if (dev->shared_resources.enable_mes)
> -		uninit_queue(*q);
> +	uninit_queue(*q);
> +	*q = NULL;
>   	return retval;
>   }
>   

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

end of thread, other threads:[~2023-03-08 17:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-08  0:19 [PATCH] drm/amdkfd: fix a potential double free in pqm_create_queue Chia-I Wu
2023-03-08 17:42 ` Felix Kuehling

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