drm/msm: Fix null pointer dereferences without iommu

[ Upstream commit 36a1d1bda7 ]

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

Fixes: bc2112583a ("drm/msm/gpu: Track global faults per address-space")
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Link: https://lore.kernel.org/r/20220421203455.313523-1-luca@z3ntu.xyz
Signed-off-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Luca Weiss 2022-04-21 22:34:53 +02:00 committed by Greg Kroah-Hartman
parent 9b28ed2247
commit f09937e80f
2 changed files with 6 additions and 2 deletions

View file

@ -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;

View file

@ -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) {