diff options
author | Yazen Ghannam <yazen.ghannam@amd.com> | 2024-03-19 06:33:21 -0500 |
---|---|---|
committer | Borislav Petkov (AMD) <bp@alien8.de> | 2024-03-25 19:00:38 +0100 |
commit | 4b0e527c9970a15ac9ec8fc44af957725b854c29 (patch) | |
tree | 05bab979ae0566af6c6ef9a644c34a7047da1c27 /drivers/ras | |
parent | 4cece764965020c22cff7665b18a012006359095 (diff) | |
download | linux-stable-4b0e527c9970a15ac9ec8fc44af957725b854c29.tar.gz linux-stable-4b0e527c9970a15ac9ec8fc44af957725b854c29.tar.bz2 linux-stable-4b0e527c9970a15ac9ec8fc44af957725b854c29.zip |
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: 6f15e617cc99 ("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
Diffstat (limited to 'drivers/ras')
-rw-r--r-- | drivers/ras/amd/fmpm.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c index 2f4ac9591c8f..9d25195b4538 100644 --- a/drivers/ras/amd/fmpm.c +++ b/drivers/ras/amd/fmpm.c @@ -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); |