Otherwise a GEM_SUBMIT ioctl before any BOs are mapped could cause a
NPE.

Reported-by: Sashiko <[email protected]>
Fixes: 6a4d287a1ae6 ("drm/msm: Mark VM as unusable on GPU hangs")
Signed-off-by: Rob Clark <[email protected]>
---
 drivers/gpu/drm/msm/msm_gem_submit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c 
b/drivers/gpu/drm/msm/msm_gem_submit.c
index 26ea8a28be47..af564acf1f0d 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -572,7 +572,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
        if (args->pad)
                return -EINVAL;
 
-       if (to_msm_vm(ctx->vm)->unusable)
+       if (ctx->vm && to_msm_vm(ctx->vm)->unusable)
                return UERR(EPIPE, dev, "context is unusable");
 
        /* for now, we just have 3d pipe.. eventually this would need to
-- 
2.54.0

Reply via email to