diff options
author | Allen Pais <allen.pais@oracle.com> | 2019-09-18 22:00:31 +0530 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-10-03 09:11:00 -0500 |
commit | 81de29d842ccb776c0f77aa3e2b11b07fff0c0e2 (patch) | |
tree | 06f5b3914d84cafeb507bd75fd3923dd8a8cbf39 | |
parent | f77c7109c071edc148dc6c71dcf927059516235f (diff) | |
download | linux-stable-81de29d842ccb776c0f77aa3e2b11b07fff0c0e2.tar.gz linux-stable-81de29d842ccb776c0f77aa3e2b11b07fff0c0e2.tar.bz2 linux-stable-81de29d842ccb776c0f77aa3e2b11b07fff0c0e2.zip |
drm/amdkfd: fix a potential NULL pointer dereference (v2)
alloc_workqueue is not checked for errors and as a result,
a potential NULL dereference could occur.
v2 (Felix Kuehling):
* Fix compile error (kfifo_free instead of fifo_free)
* Return proper error code
Signed-off-by: Allen Pais <allen.pais@oracle.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c index c56ac47cd318..bc47f6a44456 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c @@ -62,6 +62,11 @@ int kfd_interrupt_init(struct kfd_dev *kfd) } kfd->ih_wq = alloc_workqueue("KFD IH", WQ_HIGHPRI, 1); + if (unlikely(!kfd->ih_wq)) { + kfifo_free(&kfd->ih_fifo); + dev_err(kfd_chardev(), "Failed to allocate KFD IH workqueue\n"); + return -ENOMEM; + } spin_lock_init(&kfd->interrupt_lock); INIT_WORK(&kfd->interrupt_work, interrupt_wq); |