Skip to content

Commit 4b0e527

Browse files
yghannambp3tk0v
authored andcommitted
RAS/AMD/FMPM: Avoid NULL ptr deref in get_saved_records()
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
1 parent 4cece76 commit 4b0e527

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/ras/amd/fmpm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,10 @@ static int get_saved_records(void)
676676
}
677677

678678
new = get_valid_record(old);
679-
if (!new)
679+
if (!new) {
680680
erst_clear(record_id);
681+
continue;
682+
}
681683

682684
/* Restore the record */
683685
memcpy(new, old, len);

0 commit comments

Comments
 (0)