* [PATCH] drm/msm: Fix null pointer dereferences without iommu
@ 2022-04-21 20:34 Luca Weiss
0 siblings, 0 replies; only message in thread
From: Luca Weiss @ 2022-04-21 20:34 UTC (permalink / raw)
To: dri-devel
Cc: ~postmarketos/upstreaming, phone-devel, Luca Weiss, Rob Clark,
Sean Paul, Abhinav Kumar, David Airlie, Daniel Vetter,
Akhil P Oommen, Jonathan Marek, Jordan Crouse, Emma Anholt,
Stephen Boyd, Dan Carpenter, linux-arm-msm, freedreno,
linux-kernel
Check if 'aspace' is set before using it as it will stay null without
IOMMU, such as on msm8974.
Fixes: bc2112583a0b ("drm/msm/gpu: Track global faults per address-space")
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 5 ++++-
drivers/gpu/drm/msm/msm_gpu.c | 3 ++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 9efc84929be0..1219f71629a5 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -272,7 +272,10 @@ int adreno_get_param(struct msm_gpu *gpu, struct msm_file_private *ctx,
*value = 0;
return 0;
case MSM_PARAM_FAULTS:
- *value = gpu->global_faults + ctx->aspace->faults;
+ if (ctx->aspace)
+ *value = gpu->global_faults + ctx->aspace->faults;
+ else
+ *value = gpu->global_faults;
return 0;
case MSM_PARAM_SUSPENDS:
*value = gpu->suspend_count;
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index faf0c242874e..58eb3e1662cb 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -371,7 +371,8 @@ static void recover_worker(struct kthread_work *work)
/* Increment the fault counts */
submit->queue->faults++;
- submit->aspace->faults++;
+ if (submit->aspace)
+ submit->aspace->faults++;
task = get_pid_task(submit->pid, PIDTYPE_PID);
if (task) {
--
2.36.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-21 20:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 20:34 [PATCH] drm/msm: Fix null pointer dereferences without iommu Luca Weiss
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).