Skip to content

Commit 42df60f

Browse files
committed
Merge tag 'edac_urgent_for_v5.9_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras
Pull EDAC fix from Borislav Petkov: "A fix to properly clear ghes_edac driver state on driver remove so that a subsequent load can probe the system properly (Shiju Jose)" * tag 'edac_urgent_for_v5.9_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras: EDAC/ghes: Fix NULL pointer dereference in ghes_edac_register()
2 parents c401128 + b972fdb commit 42df60f

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

drivers/edac/ghes_edac.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ static DEFINE_SPINLOCK(ghes_lock);
5555
static bool __read_mostly force_load;
5656
module_param(force_load, bool, 0);
5757

58+
static bool system_scanned;
59+
5860
/* Memory Device - Type 17 of SMBIOS spec */
5961
struct memdev_dmi_entry {
6062
u8 type;
@@ -225,14 +227,12 @@ static void enumerate_dimms(const struct dmi_header *dh, void *arg)
225227

226228
static void ghes_scan_system(void)
227229
{
228-
static bool scanned;
229-
230-
if (scanned)
230+
if (system_scanned)
231231
return;
232232

233233
dmi_walk(enumerate_dimms, &ghes_hw);
234234

235-
scanned = true;
235+
system_scanned = true;
236236
}
237237

238238
void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
@@ -631,6 +631,8 @@ void ghes_edac_unregister(struct ghes *ghes)
631631

632632
mutex_lock(&ghes_reg_mutex);
633633

634+
system_scanned = false;
635+
634636
if (!refcount_dec_and_test(&ghes_refcount))
635637
goto unlock;
636638

0 commit comments

Comments
 (0)