drm/msm: potential error pointer dereference in init()
Subsystems (4)
PATCH 1/1 drm/msm: potential error pointer dereference in init()
The msm_iommu_new() returns error pointers on failure so check for that to avoid an Oops.
Fixes ccac7ce373c1 ("drm/msm: Refactor address space initialization")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +4 -0
@@ -908,6 +908,10 @@ static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms)return 0 ; mmu =msm_iommu_new (dpu_kms->dev->dev, domain); +if (IS_ERR (mmu)) { +iommu_domain_free (domain); +return PTR_ERR (mmu); + } aspace =msm_gem_address_space_create (mmu,"dpu1" ,0x1000 ,0x100000000 -0x1000 );
Signature · 1 line
2.20.1
Quoted 5 lines · Dan Carpenter
The
msm_iommu_new()returns error pointers on failure so check for that to avoid an Oops.Fixes ccac7ce373c1 ("drm/msm: Refactor address space initialization")Signed-off-by Dan Carpenter <[email protected]>
Reviewed-by Abhinav Kumar <[email protected]>
Quoted 20 lines
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +4
-0@@ -908,6 +908,10 @@ static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms)return 0 ; mmu =msm_iommu_new (dpu_kms->dev->dev, domain); +if (IS_ERR (mmu)) { +iommu_domain_free (domain); +return PTR_ERR (mmu); + } aspace =msm_gem_address_space_create (mmu,"dpu1" ,0x1000 ,0x100000000 -0x1000 );
Quoted 6 lines · Dan Carpenter
The
msm_iommu_new()returns error pointers on failure so check for that to avoid an Oops.Fixes ccac7ce373c1 ("drm/msm: Refactor address space initialization")Signed-off-by Dan Carpenter <[email protected]>---
Reviewed-by Dmitry Baryshkov <[email protected]>
Quoted 19 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +4
-0@@ -908,6 +908,10 @@ static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms)return 0 ; mmu =msm_iommu_new (dpu_kms->dev->dev, domain); +if (IS_ERR (mmu)) { +iommu_domain_free (domain); +return PTR_ERR (mmu); + } aspace =msm_gem_address_space_create (mmu,"dpu1" ,0x1000 ,0x100000000 -0x1000 );
Signature · 2 lines
With best wishes Dmitry