Commit 42df60fc authored by Linus Torvalds's avatar Linus Torvalds

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()
parents c4011283 b972fdba
...@@ -55,6 +55,8 @@ static DEFINE_SPINLOCK(ghes_lock); ...@@ -55,6 +55,8 @@ static DEFINE_SPINLOCK(ghes_lock);
static bool __read_mostly force_load; static bool __read_mostly force_load;
module_param(force_load, bool, 0); module_param(force_load, bool, 0);
static bool system_scanned;
/* Memory Device - Type 17 of SMBIOS spec */ /* Memory Device - Type 17 of SMBIOS spec */
struct memdev_dmi_entry { struct memdev_dmi_entry {
u8 type; u8 type;
...@@ -225,14 +227,12 @@ static void enumerate_dimms(const struct dmi_header *dh, void *arg) ...@@ -225,14 +227,12 @@ static void enumerate_dimms(const struct dmi_header *dh, void *arg)
static void ghes_scan_system(void) static void ghes_scan_system(void)
{ {
static bool scanned; if (system_scanned)
if (scanned)
return; return;
dmi_walk(enumerate_dimms, &ghes_hw); dmi_walk(enumerate_dimms, &ghes_hw);
scanned = true; system_scanned = true;
} }
void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) 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) ...@@ -631,6 +631,8 @@ void ghes_edac_unregister(struct ghes *ghes)
mutex_lock(&ghes_reg_mutex); mutex_lock(&ghes_reg_mutex);
system_scanned = false;
if (!refcount_dec_and_test(&ghes_refcount)) if (!refcount_dec_and_test(&ghes_refcount))
goto unlock; goto unlock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment