Commit 36a1d1bd authored by Luca Weiss's avatar Luca Weiss Committed by Rob Clark

drm/msm: Fix null pointer dereferences without iommu

Check if 'aspace' is set before using it as it will stay null without
IOMMU, such as on msm8974.

Fixes: bc211258 ("drm/msm/gpu: Track global faults per address-space")
Signed-off-by: default avatarLuca Weiss <luca@z3ntu.xyz>
Link: https://lore.kernel.org/r/20220421203455.313523-1-luca@z3ntu.xyzSigned-off-by: default avatarRob Clark <robdclark@chromium.org>
parent f1fc2b87
...@@ -276,7 +276,10 @@ int adreno_get_param(struct msm_gpu *gpu, struct msm_file_private *ctx, ...@@ -276,7 +276,10 @@ int adreno_get_param(struct msm_gpu *gpu, struct msm_file_private *ctx,
*value = 0; *value = 0;
return 0; return 0;
case MSM_PARAM_FAULTS: 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; return 0;
case MSM_PARAM_SUSPENDS: case MSM_PARAM_SUSPENDS:
*value = gpu->suspend_count; *value = gpu->suspend_count;
......
...@@ -391,7 +391,8 @@ static void recover_worker(struct kthread_work *work) ...@@ -391,7 +391,8 @@ static void recover_worker(struct kthread_work *work)
if (submit) { if (submit) {
/* Increment the fault counts */ /* Increment the fault counts */
submit->queue->faults++; submit->queue->faults++;
submit->aspace->faults++; if (submit->aspace)
submit->aspace->faults++;
get_comm_cmdline(submit, &comm, &cmd); get_comm_cmdline(submit, &comm, &cmd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment