diff options
author | Dan Carpenter | 2022-08-12 09:20:58 +0300 |
---|---|---|
committer | Alex Deucher | 2022-08-16 18:06:29 -0400 |
commit | 7d50b92d588d1e7bdcf38f523200b7b113b46c14 (patch) | |
tree | b0bcc45ccc579e2e9b88afbce8af51a233ff166f /net/ipv4 | |
parent | e48e6a131d34de54ce6852149e4c97c2208f45cc (diff) |
drm/amdkfd: potential crash in kfd_create_indirect_link_prop()
This code has two bugs. If kfd_topology_device_by_proximity_domain()
failed on the first iteration through the loop then "cpu_link" is
uninitialized and should not be dereferenced.
The second bug is that we cannot dereference a list iterator when it
points to the list head. In other words, if we exit the
list_for_each_entry() loop exits without hitting a break then "cpu_link"
is not a valid pointer and should not be dereferenced.
Fix both of these problems by setting "cpu_link" to NULL when it is invalid
and non-NULL when it is valid. That makes it easier to test for
valid vs invalid.
Fixes: 0f28cca87e9a ("drm/amdkfd: Extend KFD device topology to surface peer-to-peer links")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'net/ipv4')
0 files changed, 0 insertions, 0 deletions