[Intel-xe] [PATCH] drm/xe: Prevent null ptr dereference
Summers, Stuart
stuart.summers at intel.com
Mon Nov 6 16:31:03 UTC 2023
On Sat, 2023-11-04 at 02:49 +0530, Pallavi Mishra wrote:
> In scenarios where vm is not initialized, use xe_migrate
> to get the address.
>
> Signed-off-by: Pallavi Mishra <pallavi.mishra at intel.com>
> ---
> drivers/gpu/drm/xe/xe_migrate.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c
> b/drivers/gpu/drm/xe/xe_migrate.c
> index e6a31f90ebdb..f79ec8e4ae4e 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -1296,7 +1296,10 @@ xe_migrate_update_pgtables(struct xe_migrate
> *m,
>
> xe_tile_assert(tile, pt_bo->size == SZ_4K);
>
> - addr = vm->pt_ops->pte_encode_bo(pt_bo, 0,
> pat_index, 0);
> + if (vm)
> + addr = vm->pt_ops-
> >pte_encode_bo(pt_bo, 0, pat_index, 0);
> + else
> + addr = m->q->vm->pt_ops-
> >pte_encode_bo(pt_bo, 0, pat_index, 0);
> bb->cs[bb->len++] = lower_32_bits(addr);
> bb->cs[bb->len++] = upper_32_bits(addr);
> }
I also see this in the routine in question:
if (first_munmap_rebind) {
err = job_add_deps(job, &vm->resv,
DMA_RESV_USAGE_BOOKKEEP);
if (err)
goto err_job;
}
so looks like we have a potential for two NPDs here.
Also in xe_migrate_update_pgtables_cpu:
if (wait_vm && !dma_resv_test_signaled(&vm->resv,
DMA_RESV_USAGE_BOOKKEEP))
return ERR_PTR(-ETIME);
Thanks,
Stuart
More information about the Intel-xe
mailing list