drm/admgpu: fix dereferencing null pointer context
authorjsg <jsg@openbsd.org>
Thu, 15 Aug 2024 03:01:36 +0000 (03:01 +0000)
committerjsg <jsg@openbsd.org>
Thu, 15 Aug 2024 03:01:36 +0000 (03:01 +0000)
From Jesse Zhang
641dac64178ccdb9e45c92b67120316896294d05 in linux-6.6.y/6.6.46
030ffd4d43b433bc6671d9ec34fc12c59220b95d in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_psp_ta.c

index ca5c86e..8e8afbd 100644 (file)
@@ -334,7 +334,7 @@ static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf, size
 
        set_ta_context_funcs(psp, ta_type, &context);
 
-       if (!context->initialized) {
+       if (!context || !context->initialized) {
                dev_err(adev->dev, "TA is not initialized\n");
                ret = -EINVAL;
                goto err_free_shared_buf;