Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdkfd: fix a dereference of pdd before it is null checked

Currently pointer pdd is being dereferenced when assigning pointer
dpm and then pdd is being null checked. Fix this by checking if
pdd is null before the dereference of pdd occurs.

Addresses-Coverity: ("Dereference before null check")
Fixes: 32cb59f31362 ("drm/amdkfd: Track SDMA utilization per process")
Signed-off-by: Colin Ian King <colin.king@canonical.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>

authored by

Colin Ian King and committed by
Alex Deucher
2652bda7 48b270bb

+3 -2
+3 -2
drivers/gpu/drm/amd/amdkfd/kfd_process.c
··· 103 103 return; 104 104 105 105 pdd = workarea->pdd; 106 + if (!pdd) 107 + return; 106 108 dqm = pdd->dev->dqm; 107 109 qpd = &pdd->qpd; 108 - 109 - if (!pdd || !dqm || !qpd) 110 + if (!dqm || !qpd) 110 111 return; 111 112 112 113 mm = get_task_mm(pdd->process->lead_thread);