]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
EDAC/sysfs: Remove csrow objects on errors
authorRobert Richter <rrichter@marvell.com>
Wed, 12 Feb 2020 12:03:39 +0000 (13:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Feb 2020 18:53:03 +0000 (19:53 +0100)
commitb2e977a9731fdf33068d4bd13885cac549cb4a1c
tree9b427c7bb0c47a23f8192652f1e698a2a2b4a2a0
parent03f6c2bf9562604f914346b19a1a1c56ba93eae9
EDAC/sysfs: Remove csrow objects on errors

commit 4d59588c09f2a2daedad2a544d4d1b602ab3a8af upstream.

All created csrow objects must be removed in the error path of
edac_create_csrow_objects(). The objects have been added as devices.

They need to be removed by doing a device_del() *and* put_device() call
to also free their memory. The missing put_device() leaves a memory
leak. Use device_unregister() instead of device_del() which properly
unregisters the device doing both.

Fixes: 7adc05d2dc3a ("EDAC/sysfs: Drop device references properly")
Signed-off-by: Robert Richter <rrichter@marvell.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Tested-by: John Garry <john.garry@huawei.com>
Cc: <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/20200212120340.4764-4-rrichter@marvell.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/edac/edac_mc_sysfs.c