Skip to content

Commit

Permalink
core/pldm: Fix dangling point issue
Browse files Browse the repository at this point in the history
When calling pldm_platform_init() and the GET_PDR PLDM
request fails, the 'pdrs_repo' global variable is freed
but becomes a dangling pointer. Subsequent calls to
pldm_platform_init will lead to an invalid read.

==28652== Invalid read of size 8
==28652==    at 0x40A4C8: pldm_pdr_destroy (pdr.c:130)
==28652==    by 0x424BA3: pdr_init_complete (pldm-platform-requests.c:42)
==28652==    by 0x4274DA: pldm_platform_load_pdrs (pldm-platform-requests.c:1170)
==28652==    by 0x42759C: pdrs_init (pldm-platform-requests.c:1190)
==28652==    by 0x427703: pldm_platform_init (pldm-platform-requests.c:1221)

Signed-off-by: Abhishek Singh Tomar <[email protected]>
Signed-off-by: Reza Arbab <[email protected]>
  • Loading branch information
abhisheksinghtomar authored and rarbab committed Aug 2, 2024
1 parent 6d1fb19 commit a9830fc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/pldm/pldm-platform-requests.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ static void pdr_init_complete(bool success)
if (!success) {
pdr_ready = false;

if (pdrs_repo)
if (pdrs_repo) {
pldm_pdr_destroy(pdrs_repo);
pdrs_repo = NULL;
}
return;
}

Expand Down

0 comments on commit a9830fc

Please sign in to comment.