diff options
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.19.8/2787-drm-amdkfd-fix-null-pointer-dereference-on-dev.patch')
-rw-r--r-- | common/recipes-kernel/linux/linux-yocto-4.19.8/2787-drm-amdkfd-fix-null-pointer-dereference-on-dev.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.19.8/2787-drm-amdkfd-fix-null-pointer-dereference-on-dev.patch b/common/recipes-kernel/linux/linux-yocto-4.19.8/2787-drm-amdkfd-fix-null-pointer-dereference-on-dev.patch new file mode 100644 index 00000000..945bb7c4 --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-4.19.8/2787-drm-amdkfd-fix-null-pointer-dereference-on-dev.patch @@ -0,0 +1,47 @@ +From 03a1f476fd23fbded0c94c1c7ac03baa77f2caf6 Mon Sep 17 00:00:00 2001 +From: Colin Ian King <colin.king@canonical.com> +Date: Wed, 29 May 2019 16:07:34 +0100 +Subject: [PATCH 2787/2940] drm/amdkfd: fix null pointer dereference on dev + +The pointer dev is set to null yet it is being dereferenced when +checking dev->dqm->sched_policy. Fix this by performing the check +on dev->dqm->sched_policy after dev has been assigned and null +checked. Also remove the redundant null assignment to dev. + +Addresses-Coverity: ("Explicit null dereference") +Fixes: 1a058c337676 ("drm/amdkfd: New IOCTL to allocate queue GWS") +Signed-off-by: Colin Ian King <colin.king@canonical.com> +Signed-off-by: Alex Deucher <alexander.deucher@amd.com> +--- + drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +index aa5243546ae1..aa321bad7cca 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +@@ -1611,10 +1611,9 @@ static int kfd_ioctl_alloc_queue_gws(struct file *filep, + { + int retval; + struct kfd_ioctl_alloc_queue_gws_args *args = data; +- struct kfd_dev *dev = NULL; ++ struct kfd_dev *dev; + +- if (!hws_gws_support || +- dev->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS) ++ if (!hws_gws_support) + return -EINVAL; + + dev = kfd_device_by_id(args->gpu_id); +@@ -1622,6 +1621,8 @@ static int kfd_ioctl_alloc_queue_gws(struct file *filep, + pr_debug("Could not find gpu id 0x%x\n", args->gpu_id); + return -EINVAL; + } ++ if (dev->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS) ++ return -EINVAL; + + mutex_lock(&p->mutex); + retval = pqm_set_gws(&p->pqm, args->queue_id, args->num_gws ? dev->gws : NULL); +-- +2.17.1 + |