Skip to content

Commit

Permalink
RAS/AMD/FMPM: Avoid NULL ptr deref in get_saved_records()
Browse files Browse the repository at this point in the history
An old, invalid record should be cleared and skipped.

Currently, the record is cleared in ERST, but it is not skipped. This
leads to a NULL pointer dereference when attempting to copy the old
record to the new record.

Continue the loop after clearing an old, invalid record to skip it.

Fixes: 6f15e61 ("RAS: Introduce a FRU memory poison manager")
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Muralidhara M K <muralidhara.mk@amd.com>
Link: https://lore.kernel.org/r/20240319113322.280096-2-yazen.ghannam@amd.com
  • Loading branch information
Yazen Ghannam authored and Borislav Petkov (AMD) committed Mar 25, 2024
1 parent 4cece76 commit 4b0e527
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/ras/amd/fmpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,10 @@ static int get_saved_records(void)
}

new = get_valid_record(old);
if (!new)
if (!new) {
erst_clear(record_id);
continue;
}

/* Restore the record */
memcpy(new, old, len);
Expand Down

0 comments on commit 4b0e527

Please sign in to comment.