Skip to content

Commit a592bb1

Browse files
andmar-amdalexdeucher
authored andcommitted
drm/amdkfd: Dereference null return value
In the function pqm_uninit there is a call-assignment of "pdd = kfd_get_process_device_data" which could be null, and this value was later dereferenced without checking. Fixes: fb91065 ("drm/amdkfd: Refactor queue wptr_bo GART mapping") Signed-off-by: Andrew Martin <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent 5c3de6b commit a592bb1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,17 @@ static void pqm_clean_queue_resource(struct process_queue_manager *pqm,
212212
void pqm_uninit(struct process_queue_manager *pqm)
213213
{
214214
struct process_queue_node *pqn, *next;
215-
struct kfd_process_device *pdd;
216215

217216
list_for_each_entry_safe(pqn, next, &pqm->queues, process_queue_list) {
218217
if (pqn->q) {
219-
pdd = kfd_get_process_device_data(pqn->q->device, pqm->process);
220-
kfd_queue_unref_bo_vas(pdd, &pqn->q->properties);
221-
kfd_queue_release_buffers(pdd, &pqn->q->properties);
218+
struct kfd_process_device *pdd = kfd_get_process_device_data(pqn->q->device,
219+
pqm->process);
220+
if (pdd) {
221+
kfd_queue_unref_bo_vas(pdd, &pqn->q->properties);
222+
kfd_queue_release_buffers(pdd, &pqn->q->properties);
223+
} else {
224+
WARN_ON(!pdd);
225+
}
222226
pqm_clean_queue_resource(pqm, pqn);
223227
}
224228

0 commit comments

Comments
 (0)