Skip to content

Commit

Permalink
Merge tag 'edac_urgent_for_v5.9_rc3' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…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()
  • Loading branch information
torvalds committed Aug 30, 2020
2 parents c401128 + b972fdb commit 42df60f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/edac/ghes_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ static DEFINE_SPINLOCK(ghes_lock);
static bool __read_mostly force_load;
module_param(force_load, bool, 0);

static bool system_scanned;

/* Memory Device - Type 17 of SMBIOS spec */
struct memdev_dmi_entry {
u8 type;
Expand Down Expand Up @@ -225,14 +227,12 @@ static void enumerate_dimms(const struct dmi_header *dh, void *arg)

static void ghes_scan_system(void)
{
static bool scanned;

if (scanned)
if (system_scanned)
return;

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)
Expand Down Expand Up @@ -631,6 +631,8 @@ void ghes_edac_unregister(struct ghes *ghes)

mutex_lock(&ghes_reg_mutex);

system_scanned = false;

if (!refcount_dec_and_test(&ghes_refcount))
goto unlock;

Expand Down

0 comments on commit 42df60f

Please sign in to comment.