summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2019-07-03 21:19:23 -0400
committerDave Airlie <airlied@redhat.com>2019-07-03 21:19:34 -0400
commitb5252bdf099a465e6b707e7cf11b7ef0b1e4cf09 (patch)
tree3ca2914a62e5966666d996f5cc6e826fafd6fe6b /drivers/gpu
parenta956c56b6ad3c2812cf6158eaa579c4f4012e7ab (diff)
parentbe132e1375c1fffe48801296279079f8a59a9ed3 (diff)
Merge branch 'etnaviv/fixes' of https://git.pengutronix.de/git/lst/linux into drm-fixes
Fix a kernel nullptr deref on module unload when any etnaviv GPU failed to initialize properly. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Lucas Stach <l.stach@pengutronix.de> Link: https://patchwork.freedesktop.org/patch/msgid/1561974148.2321.1.camel@pengutronix.de
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gpu.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 72d01e873160..5418a1a87b2c 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -760,7 +760,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
760 if (IS_ERR(gpu->cmdbuf_suballoc)) { 760 if (IS_ERR(gpu->cmdbuf_suballoc)) {
761 dev_err(gpu->dev, "Failed to create cmdbuf suballocator\n"); 761 dev_err(gpu->dev, "Failed to create cmdbuf suballocator\n");
762 ret = PTR_ERR(gpu->cmdbuf_suballoc); 762 ret = PTR_ERR(gpu->cmdbuf_suballoc);
763 goto fail; 763 goto destroy_iommu;
764 } 764 }
765 765
766 /* Create buffer: */ 766 /* Create buffer: */
@@ -768,7 +768,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
768 PAGE_SIZE); 768 PAGE_SIZE);
769 if (ret) { 769 if (ret) {
770 dev_err(gpu->dev, "could not create command buffer\n"); 770 dev_err(gpu->dev, "could not create command buffer\n");
771 goto destroy_iommu; 771 goto destroy_suballoc;
772 } 772 }
773 773
774 if (gpu->mmu->version == ETNAVIV_IOMMU_V1 && 774 if (gpu->mmu->version == ETNAVIV_IOMMU_V1 &&
@@ -800,6 +800,9 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
800free_buffer: 800free_buffer:
801 etnaviv_cmdbuf_free(&gpu->buffer); 801 etnaviv_cmdbuf_free(&gpu->buffer);
802 gpu->buffer.suballoc = NULL; 802 gpu->buffer.suballoc = NULL;
803destroy_suballoc:
804 etnaviv_cmdbuf_suballoc_destroy(gpu->cmdbuf_suballoc);
805 gpu->cmdbuf_suballoc = NULL;
803destroy_iommu: 806destroy_iommu:
804 etnaviv_iommu_destroy(gpu->mmu); 807 etnaviv_iommu_destroy(gpu->mmu);
805 gpu->mmu = NULL; 808 gpu->mmu = NULL;