diff options
author | Shiju Jose <shiju.jose@huawei.com> | 2020-08-27 15:04:50 +0100 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2020-08-27 18:04:07 +0200 |
commit | b972fdba8665d75109ade0357739f46af6415d2a (patch) | |
tree | ad189170d20c38c531ffbaa84f8a7c94b5fe2f70 /drivers/pci/hotplug/shpchp_ctrl.c | |
parent | d012a7190fc1fd72ed48911e77ca97ba4521bccd (diff) |
EDAC/ghes: Fix NULL pointer dereference in ghes_edac_register()
After
b9cae27728d1 ("EDAC/ghes: Scan the system once on driver init")
and with CONFIG_DEBUG_TEST_DRIVER_REMOVE enabled, ghes_hw.dimms becomes
a NULL pointer after the second ->probe() (aka ghes_edac_register())
which the config option causes to be called.
This happens because the static variable which holds down whether
the system has been scanned already, doesn't get reset in
ghes_edac_unregister(). Then, on the second probe, ghes_scan_system()
doesn't get to enumerate the DIMMs, leading to ghes_hw.dimms remaining
NULL.
Clear the variable and rename it to something more descriptive so that a
second probe succeeds.
[ bp: Rewrite commit message. ]
Fixes: b9cae27728d1 ("EDAC/ghes: Scan the system once on driver init")
Suggested-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200827140450.1620-1-shiju.jose@huawei.com
Diffstat (limited to 'drivers/pci/hotplug/shpchp_ctrl.c')
0 files changed, 0 insertions, 0 deletions