BUG: amdgpu: NULL pointer dereference introduced in 5.9-rc1
Subsystems (2)
Commit c1cf79ca5ced46 (drm/amdgpu: use IP discovery table for renoir) introduced a NULL pointer dereference when booting with amdgpu.discovery=0.
For amdgpu.discovery=0 that commit effectively removed the call of vega10_reg_base_init(adev), so I tested the correctness of the bisect session by restoring that function call for amdgpu_discovery == 0 and with that change, the NULL pointer dereference does not occur:
drivers/gpu/drm/amd/amdgpu/soc15.c +2 -1
@@ -699,7 +699,8 @@ static void soc15_reg_base_init(struct amdgpu_device *adev) "fallback to legacy init method\n");vega10_reg_base_init (adev); } - } + }else +vega10_reg_base_init (adev);break ;case CHIP_VEGA20 :vega20_reg_base_init (adev);
Dirk
Quoted 10 lines · Dirk Gouders
Commit
c1cf79ca5ced46(drm/amdgpu: use IP discovery table for renoir) introduced a NULL pointer dereference when booting with amdgpu.discovery=0.For amdgpu.discovery=0 that commit effectively removed the call of
vega10_reg_base_init(adev), so I tested the correctness of the bisect session by restoring that function call foramdgpu_discovery== 0 and with that change, the NULL pointer dereference does not occur:
Can I add your Signed-off-by?
Thanks,
Alex
Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-1@@ -699,7 +699,8 @@ static void soc15_reg_base_init(struct amdgpu_device *adev) "fallback to legacy init method\n");vega10_reg_base_init (adev); } - } + }else +vega10_reg_base_init (adev);break ;case CHIP_VEGA20 :vega20_reg_base_init (adev);
Quoted 5 lines
Dirk
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 1/1 drm/amdgpu: fix NULL pointer dereference for Renoir
Commit c1cf79ca5ced46 (drm/amdgpu: use IP discovery table for renoir) introduced a NULL pointer dereference when booting with amdgpu.discovery=0, because it removed the call of vega10_reg_base_init() for that case.
Fix this by calling that funcion if amdgpu_discovery == 0 in addition to the case that amdgpu_discovery_reg_base_init() failed.
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +5 -5
@@ -694,12 +694,12 @@ static void soc15_reg_base_init(struct amdgpu_device *adev)* it doesn't support SRIOV. */ if (amdgpu_discovery) { r =amdgpu_discovery_reg_base_init (adev); -if (r) { -DRM_WARN ("failed to init reg base from ip discovery table, " -"fallback to legacy init method\n" ); -vega10_reg_base_init (adev); - } +if (r ==0 ) +break ; +DRM_WARN ("failed to init reg base from ip discovery table, " +"fallback to legacy init method\n" ); } +vega10_reg_base_init (adev);break ;case CHIP_VEGA20 :vega20_reg_base_init (adev);
Signature · 1 line
2.26.2
cover drm/amdgpu: fix NULL pointer dereference for Renoir
In reply to Alex DeucherQuoted 6 lines · Alex Deucher
Quoted 5 lines · Dirk Gouders
Commit
c1cf79ca5ced46(drm/amdgpu: use IP discovery table for renoir) introduced a NULL pointer dereference when booting with amdgpu.discovery=0.
Quoted 7 lines
Quoted 5 lines
For amdgpu.discovery=0 that commit effectively removed the call of
vega10_reg_base_init(adev), so I tested the correctness of the bisect session by restoring that function call foramdgpu_discovery== 0 and with that change, the NULL pointer dereference does not occur:Can I add your Signed-off-by?
I did not expect the diff to be seen as a proposed patch, not even that it shows the correct fix.
Anyway, I did my best to create a hopefully acceptable patch with some modification of the code that avoids "else" and an identical function call at two places in the code.
I testet that patch with amdgpu.discovery={0,1} and together with the patch for the first issue you helped me with. The result is no more call traces.
Thank you for your patient assistance with the two issues.
Dirk
Quoted 19 lines
Thanks,
Alex
Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-1@@ -699,7 +699,8 @@ static void soc15_reg_base_init(struct amdgpu_device *adev) "fallback to legacy init method\n");vega10_reg_base_init (adev); } - } + }else +vega10_reg_base_init (adev);break ;case CHIP_VEGA20 :vega20_reg_base_init (adev);
Quoted 5 lines
Quoted 5 lines
Dirk
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Dirk Gouders (1):
drm/amdgpu: fix NULL pointer dereference for Renoir
drivers/gpu/drm/amd/amdgpu/soc15.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.26.2
Re: [PATCH 1/1] drm/amdgpu: fix NULL pointer dereference for Renoir
In reply to Dirk GoudersQuoted 21 lines · Dirk Gouders
Commit
c1cf79ca5ced46(drm/amdgpu: use IP discovery table for renoir) introduced a NULL pointer dereference when booting with amdgpu.discovery=0, because it removed the call ofvega10_reg_base_init()for that case.Fix this by calling that funcion if
amdgpu_discovery== 0 in addition to the case thatamdgpu_discovery_reg_base_init()failed.Fixes c1cf79ca5ced46 (drm/amdgpu: use IP discovery table for renoir)Signed-off-by Dirk Gouders <[email protected]>Cc Hawking Zhang <[email protected]>Cc Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/soc15.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0
drivers/gpu/drm/amd/amdgpu/soc15.c static void soc15_reg_base_init(struct amdgpu_device *adev) · line 698
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-5@@ -694,12 +694,12 @@ static void soc15_reg_base_init(struct amdgpu_device *adev)* it doesn't support SRIOV. */ if (amdgpu_discovery) { r =amdgpu_discovery_reg_base_init (adev); -if (r) { -DRM_WARN ("failed to init reg base from ip discovery table, " -"fallback to legacy init method\n" ); -vega10_reg_base_init (adev); - } +if (r ==0 ) +break ;
Grrr, wrong indentation here.
But I will wait for your review before v1.
Dirk
drivers/gpu/drm/amd/amdgpu/soc15.c static void soc15_reg_base_init(struct amdgpu_device *adev) · line 705
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +3
-0+DRM_WARN ("failed to init reg base from ip discovery table, " +"fallback to legacy init method\n" ); } +vega10_reg_base_init (adev);break ;case CHIP_VEGA20 :vega20_reg_base_init (adev);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 1/1] drm/amdgpu: fix NULL pointer dereference for Renoir
Quoted 29 lines · Dirk Gouders
Quoted 26 lines · Dirk Gouders
Commit
c1cf79ca5ced46(drm/amdgpu: use IP discovery table for renoir) introduced a NULL pointer dereference when booting with amdgpu.discovery=0, because it removed the call ofvega10_reg_base_init()for that case.Fix this by calling that funcion if
amdgpu_discovery== 0 in addition to the case thatamdgpu_discovery_reg_base_init()failed.Fixes c1cf79ca5ced46 (drm/amdgpu: use IP discovery table for renoir)Signed-off-by Dirk Gouders <[email protected]>Cc Hawking Zhang <[email protected]>Cc Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/soc15.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/soc15.c +0
-2@@ -694,12 +694,12 @@ static void soc15_reg_base_init(struct amdgpu_device *adev)* it doesn't support SRIOV. */ if (amdgpu_discovery) { r =amdgpu_discovery_reg_base_init (adev); -if (r) { - DRM_WARN("failed to init reg base from ip discovery table, "
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/soc15.c static void soc15_reg_base_init(struct amdgpu_device *adev) · line 698
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-3- "fallback to legacy init method\n"); -vega10_reg_base_init (adev); - } +if (r ==0 ) +break ;Grrr, wrong indentation here.
But I will wait for your review before v1.
Fixed up locally and applied. Thanks!
Alex
Quoted 11 lines
Dirk
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +3
-0+DRM_WARN ("failed to init reg base from ip discovery table, " +"fallback to legacy init method\n" ); } +vega10_reg_base_init (adev);break ;case CHIP_VEGA20 :vega20_reg_base_init (adev);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx