* [PATCH] drm/amdgpu: add missing NULL check
@ 2023-10-06 12:11 Christian König
2023-10-06 14:41 ` Alex Deucher
2023-10-09 13:13 ` Samuel Pitoiset
0 siblings, 2 replies; 4+ messages in thread
From: Christian König @ 2023-10-06 12:11 UTC (permalink / raw)
To: samuel.pitoiset, amd-gfx
bo->tbo.resource can easily be NULL here.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
index f3ee83cdf97e..d28e21baef16 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
@@ -252,7 +252,7 @@ static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo)
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
struct amdgpu_res_cursor cursor;
- if (bo->tbo.resource->mem_type != TTM_PL_VRAM)
+ if (!bo->tbo.resource || bo->tbo.resource->mem_type != TTM_PL_VRAM)
return false;
amdgpu_res_first(bo->tbo.resource, 0, amdgpu_bo_size(bo), &cursor);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu: add missing NULL check
2023-10-06 12:11 [PATCH] drm/amdgpu: add missing NULL check Christian König
@ 2023-10-06 14:41 ` Alex Deucher
2023-10-09 9:25 ` Christian König
2023-10-09 13:13 ` Samuel Pitoiset
1 sibling, 1 reply; 4+ messages in thread
From: Alex Deucher @ 2023-10-06 14:41 UTC (permalink / raw)
To: Christian König; +Cc: amd-gfx, samuel.pitoiset
On Fri, Oct 6, 2023 at 9:07 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> bo->tbo.resource can easily be NULL here.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
Add a link to the bug report? With that:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> index f3ee83cdf97e..d28e21baef16 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> @@ -252,7 +252,7 @@ static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo)
> struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
> struct amdgpu_res_cursor cursor;
>
> - if (bo->tbo.resource->mem_type != TTM_PL_VRAM)
> + if (!bo->tbo.resource || bo->tbo.resource->mem_type != TTM_PL_VRAM)
> return false;
>
> amdgpu_res_first(bo->tbo.resource, 0, amdgpu_bo_size(bo), &cursor);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu: add missing NULL check
2023-10-06 14:41 ` Alex Deucher
@ 2023-10-09 9:25 ` Christian König
0 siblings, 0 replies; 4+ messages in thread
From: Christian König @ 2023-10-09 9:25 UTC (permalink / raw)
To: Alex Deucher; +Cc: amd-gfx, samuel.pitoiset
Am 06.10.23 um 16:41 schrieb Alex Deucher:
> On Fri, Oct 6, 2023 at 9:07 AM Christian König
> <ckoenig.leichtzumerken@gmail.com> wrote:
>> bo->tbo.resource can easily be NULL here.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
> Add a link to the bug report?
Ah, crap. Forgotten to add the link before pushing that. But I've added
a CC stable.
Apart from that I suspect that this doesn't fix the real issue here, it
just mitigates the problem.
For some reason we can't allocate OA resources, but also doesn't fail
and instead keep working with an empty BO.
Regards,
Christian.
> With that:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
>> index f3ee83cdf97e..d28e21baef16 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
>> @@ -252,7 +252,7 @@ static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo)
>> struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
>> struct amdgpu_res_cursor cursor;
>>
>> - if (bo->tbo.resource->mem_type != TTM_PL_VRAM)
>> + if (!bo->tbo.resource || bo->tbo.resource->mem_type != TTM_PL_VRAM)
>> return false;
>>
>> amdgpu_res_first(bo->tbo.resource, 0, amdgpu_bo_size(bo), &cursor);
>> --
>> 2.34.1
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu: add missing NULL check
2023-10-06 12:11 [PATCH] drm/amdgpu: add missing NULL check Christian König
2023-10-06 14:41 ` Alex Deucher
@ 2023-10-09 13:13 ` Samuel Pitoiset
1 sibling, 0 replies; 4+ messages in thread
From: Samuel Pitoiset @ 2023-10-09 13:13 UTC (permalink / raw)
To: Christian König, amd-gfx
I can confirm this patch fixes the kernel crash I reported.
But as discussed with Christian, we should find the root cause.
On 10/6/23 14:11, Christian König wrote:
> bo->tbo.resource can easily be NULL here.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> index f3ee83cdf97e..d28e21baef16 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> @@ -252,7 +252,7 @@ static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo)
> struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
> struct amdgpu_res_cursor cursor;
>
> - if (bo->tbo.resource->mem_type != TTM_PL_VRAM)
> + if (!bo->tbo.resource || bo->tbo.resource->mem_type != TTM_PL_VRAM)
> return false;
>
> amdgpu_res_first(bo->tbo.resource, 0, amdgpu_bo_size(bo), &cursor);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-09 13:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-06 12:11 [PATCH] drm/amdgpu: add missing NULL check Christian König
2023-10-06 14:41 ` Alex Deucher
2023-10-09 9:25 ` Christian König
2023-10-09 13:13 ` Samuel Pitoiset
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.