drm/amdgpu: fix null pointer reference to adev.
Subsystems (2)
Christian König
maintainerAm 07.07.20 um 05:26 schrieb Lepton Wu:
Quoted 3 lines
I hit this when compiling amdgpu in kernel.
amdgpu_driver_load_kmsfail to load firmwares since GPU was initialized before rootfs is ready. Just gracefully fail in such cases.
Good catch, but the solution looks incorrect to me.
The underlying problem is that the return value of amdgpu_driver_load_kms() is not correctly checked.
Christian.
Quoted 26 lines
Signed-off-by Lepton Wu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2
-1@@ -1124,7 +1124,8 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, goto err_pci; adev = dev->dev_private; - ret =amdgpu_debugfs_init (adev); +if (adev) + ret =amdgpu_debugfs_init (adev);if (ret)DRM_ERROR ("Creating debugfs files failed (%d).\n" , ret);drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) · line 985
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2
-0@@ -978,6 +978,8 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)struct amdgpu_fpriv *fpriv;int r, pasid; +if (!adev) +return -ENODEV ;/* Ensure IB tests are run on ring */ flush_delayed_work (&adev->delayed_init_work);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 1/1 drm/amdgpu: fix null pointer reference to adev.
I hit this when compiling amdgpu in kernel. amdgpu_driver_load_kms fail to load firmwares since GPU was initialized before rootfs is ready. Just gracefully fail in such cases.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
@@ -1124,7 +1124,8 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, goto err_pci; adev = dev->dev_private; - ret =amdgpu_debugfs_init (adev); +if (adev) + ret =amdgpu_debugfs_init (adev);if (ret)DRM_ERROR ("Creating debugfs files failed (%d).\n" , ret);
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
@@ -978,6 +978,8 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)struct amdgpu_fpriv *fpriv;int r, pasid; +if (!adev) +return -ENODEV ;/* Ensure IB tests are run on ring */ flush_delayed_work (&adev->delayed_init_work);
Signature · 6 lines
2.27.0.212.ge8ba1cc988-goog _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v2 1/1 drm/amdgpu: fix null pointer reference to adev.
In reply to Christian KönigI hit this when compiling amdgpu in kernel. amdgpu_driver_load_kms fail to load firmwares since GPU was initialized before rootfs is ready. Just gracefully fail in such cases.
v2: Check return code of amdgpu_driver_load_kms
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
@@ -1111,7 +1111,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,pci_set_drvdata (pdev, dev); -amdgpu_driver_load_kms (dev, ent->driver_data); + ret =amdgpu_driver_load_kms (dev, ent->driver_data); +if (ret) + goto err_pci; retry_init: ret =drm_dev_register (dev, ent->driver_data);
Signature · 6 lines
2.27.0.212.ge8ba1cc988-goog _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 8 lines · Lepton Wu
I hit this when compiling amdgpu in kernel.
amdgpu_driver_load_kmsfail to load firmwares since GPU was initialized before rootfs is ready. Just gracefully fail in such cases.v2: Check return code of
amdgpu_driver_load_kmsSigned-off-by Lepton Wu <[email protected]>
Already fixed:
https://cgit.freedesktop.org/drm/drm/commit/?id=7504d3bbec7da70516a13e34415b92bf5203399a
Alex
Quoted 22 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3
-2@@ -1111,7 +1111,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,pci_set_drvdata (pdev, dev); -amdgpu_driver_load_kms (dev, ent->driver_data); + ret =amdgpu_driver_load_kms (dev, ent->driver_data); +if (ret) + goto err_pci; retry_init: ret =drm_dev_register (dev, ent->driver_data); --2.27.0.212.ge8ba1cc988-goog
Quoted 4 lines
_______________________________________________
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
Quoted 7 lines · Alex Deucher
Quoted 5 lines · Lepton Wu
I hit this when compiling amdgpu in kernel.
amdgpu_driver_load_kmsfail to load firmwares since GPU was initialized before rootfs is ready. Just gracefully fail in such cases.
Quoted 6 lines
Quoted 3 lines
v2: Check return code of
amdgpu_driver_load_kmsSigned-off-by Lepton Wu <[email protected]>Already fixed:
https://cgit.freedesktop.org/drm/drm/commit/?id=7504d3bbec7da70516a13e34415b92bf5203399a
Nice, next time I will check drm tree instead of Linus tree for drm related stuff.
Quoted 25 lines
Alex
Quoted 22 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3
-2@@ -1111,7 +1111,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,pci_set_drvdata (pdev, dev); -amdgpu_driver_load_kms (dev, ent->driver_data); + ret =amdgpu_driver_load_kms (dev, ent->driver_data); +if (ret) + goto err_pci; retry_init: ret =drm_dev_register (dev, ent->driver_data); --2.27.0.212.ge8ba1cc988-goog
Quoted 4 lines
Quoted 4 lines
_______________________________________________
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