drm/nouveau/acr: return error when registering LSF if ACR not supported
authorBen Skeggs <bskeggs@redhat.com>
Wed, 29 Jan 2020 01:20:34 +0000 (11:20 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 29 Jan 2020 05:49:56 +0000 (15:49 +1000)
This fixes an oops on TU11x GPUs where SEC2 attempts to register its falcon,
and triggers a NULL-pointer deref because ACR isn't yet supported.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c

index 9896462960ea374d1343a83dde53ec1e5f1a4e0f..07d1830126abf5bbcef73651bbcf7c0dab48c946 100644 (file)
@@ -58,8 +58,12 @@ struct nvkm_acr_lsfw *
 nvkm_acr_lsfw_add(const struct nvkm_acr_lsf_func *func, struct nvkm_acr *acr,
                 struct nvkm_falcon *falcon, enum nvkm_acr_lsf_id id)
 {
-       struct nvkm_acr_lsfw *lsfw = nvkm_acr_lsfw_get(acr, id);
+       struct nvkm_acr_lsfw *lsfw;
+
+       if (!acr)
+               return ERR_PTR(-ENOSYS);
 
+       lsfw = nvkm_acr_lsfw_get(acr, id);
        if (lsfw && lsfw->func) {
                nvkm_error(&acr->subdev, "LSFW %d redefined\n", id);
                return ERR_PTR(-EEXIST);