mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	"David (Ming Qiang) Wu" <David.Wu3@amd.com>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] drm/amdgpu: clear job on failure in amdgpu_job_alloc(_with_ib)
Date: Mon, 24 Nov 2025 20:25:09 +0100	[thread overview]
Message-ID: <a4ee8918-d647-4028-affb-0bdc202cc183@amd.com> (raw)
In-Reply-To: <20251124163615.6388-1-pierre-eric.pelloux-prayer@amd.com>

On 11/24/25 17:36, Pierre-Eric Pelloux-Prayer wrote:
> If memory is freed we need to nullify the pointer or the caller
> might call kfree again (eg: amdgpu_cs_parser_fini calls kfree on
> all non-null job pointers).
> 
> Fixes: a35c520c1611 ("drm/amdgpu: clean up and unify hw fence handling")
> Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com> for both patches.

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> index efa3281145f6..2fc3d9da0fe7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> @@ -225,6 +225,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>  	kfree((*job)->hw_fence);
>  err_job:
>  	kfree(*job);
> +	*job = NULL;
>  
>  	return r;
>  }
> @@ -246,6 +247,7 @@ int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev,
>  		if (entity)
>  			drm_sched_job_cleanup(&(*job)->base);
>  		kfree(*job);
> +		*job = NULL;
>  	}
>  
>  	return r;


      parent reply	other threads:[~2025-11-24 19:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-24 16:36 Pierre-Eric Pelloux-Prayer
2025-11-24 16:36 ` [PATCH v1 2/2] drm/amdgpu: free job fences on failure in amdgpu_job_alloc_with_ib Pierre-Eric Pelloux-Prayer
2025-11-24 17:00   ` Alex Deucher
2025-11-24 19:25 ` Christian König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a4ee8918-d647-4028-affb-0bdc202cc183@amd.com \
    --to=christian.koenig@amd.com \
    --cc=David.Wu3@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre-eric.pelloux-prayer@amd.com \
    --cc=simona@ffwll.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®