mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
EDAC: Fix used after kfree() error in edac_unregister_sysfs()
Code flow looks like this:
device_unregister(&mci->dev);
-> kobject_put+0x25/0x50
-> kobject_cleanup+0x77/0x190
-> device_release+0x32/0xa0
-> mci_attr_release+0x36/0x70
-> kfree(mci);
bus_unregister(mci->bus);
Fix is to grab a local copy of "mci->bus" and use that when we call
bus_unregister().
Signed-off-by: Tony Luck <[email protected]>
Acked-by: Aristeu Rozanski <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: linux-edac <[email protected]>
Link: http://lkml.kernel.org/r/21d595b0ab3d718d9cb206647f4ec91c05e62ec4.1461261078.git.tony.luck@intel.com
Signed-off-by: Borislav Petkov <[email protected]>
This commit is contained in:
parent
1aa6eb5c5b
commit
ab67b6c22d
1 changed files with 2 additions and 1 deletions
|
|
@ -998,11 +998,12 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)
|
|||
|
||||
void edac_unregister_sysfs(struct mem_ctl_info *mci)
|
||||
{
|
||||
struct bus_type *bus = mci->bus;
|
||||
const char *name = mci->bus->name;
|
||||
|
||||
edac_dbg(1, "Unregistering device %s\n", dev_name(&mci->dev));
|
||||
device_unregister(&mci->dev);
|
||||
bus_unregister(mci->bus);
|
||||
bus_unregister(bus);
|
||||
kfree(name);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue