[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240312154937.1102727-1-yazen.ghannam@amd.com>
Date: Tue, 12 Mar 2024 10:49:37 -0500
From: Yazen Ghannam <yazen.ghannam@....com>
To: <bp@...en8.de>, <tony.luck@...el.com>, <linux-edac@...r.kernel.org>
CC: <linux-kernel@...r.kernel.org>, <avadhut.naik@....com>,
<john.allen@....com>, <naveenkrishna.chatradhi@....com>,
<muralidhara.mk@....com>, Yazen Ghannam <yazen.ghannam@....com>
Subject: [PATCH] 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@....com>
---
drivers/ras/amd/fmpm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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);
base-commit: 855684c7d938c2442f07eabc154e7532b4c1fbf9
--
2.34.1
Powered by blists - more mailing lists