diff options
author | Dan Carpenter <[email protected]> | 2022-08-12 09:20:58 +0300 |
---|---|---|
committer | Alex Deucher <[email protected]> | 2022-08-16 18:06:29 -0400 |
commit | 7d50b92d588d1e7bdcf38f523200b7b113b46c14 (patch) | |
tree | b0bcc45ccc579e2e9b88afbce8af51a233ff166f /tools/testing/selftests/bpf/prog_tests/autoload.c | |
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 <[email protected]>
Signed-off-by: Felix Kuehling <[email protected]>
Reviewed-by: Felix Kuehling <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/autoload.c')
0 files changed, 0 insertions, 0 deletions