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()
Unified · Split
| @@ -55,6 +55,8 @@ static DEFINE_SPINLOCK(ghes_lock); · 54 unmodified lines | ||
| 55 | 55 | static bool __read_mostly force_load; |
| 56 | 56 | module_param(force_load, bool, 0); |
| 57 | 57 | |
| 58 | +static bool system_scanned; | |
| 59 | + | |
| 58 | 60 | /* Memory Device - Type 17 of SMBIOS spec */ |
| 59 | 61 | struct memdev_dmi_entry { |
| 60 | 62 | u8 type; |
| @@ -225,14 +227,12 @@ static void enumerate_dimms(const struct dmi_header *dh, void *arg) · 164 unmodified lines | ||
| 225 | 227 | |
| 226 | 228 | static void ghes_scan_system(void) |
| 227 | 229 | { |
| 228 | − static bool scanned; | |
| 229 | − | |
| 230 | − if (scanned) | |
| 230 | + if (system_scanned) | |
| 231 | 231 | return; |
| 232 | 232 | |
| 233 | 233 | dmi_walk(enumerate_dimms, &ghes_hw); |
| 234 | 234 | |
| 235 | − scanned = true; | |
| 235 | + system_scanned = true; | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | 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) · 392 unmodified lines | ||
| 631 | 631 | |
| 632 | 632 | mutex_lock(&ghes_reg_mutex); |
| 633 | 633 | |
| 634 | + system_scanned = false; | |
| 635 | + | |
| 634 | 636 | if (!refcount_dec_and_test(&ghes_refcount)) |
| 635 | 637 | goto unlock; |
| 636 | 638 | |