diff options
author | Qiushi Wu <wu000273@umn.edu> | 2020-05-28 23:22:37 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-08-19 09:26:05 +0300 |
commit | 012f0e4c9732b6025902db52e74d80af59a50d9f (patch) | |
tree | 56cfd5d3697bf0bf802dcfdc6a049a75a0b861f5 /lib | |
parent | b069187f3044b97aa4992df898151a14475a3b63 (diff) | |
download | linux-012f0e4c9732b6025902db52e74d80af59a50d9f.tar.xz |
EDAC: Fix reference count leaks
[ Upstream commit 17ed808ad243192fb923e4e653c1338d3ba06207 ]
When kobject_init_and_add() returns an error, it should be handled
because kobject_init_and_add() takes a reference even when it fails. If
this function returns an error, kobject_put() must be called to properly
clean up the memory associated with the object.
Therefore, replace calling kfree() and call kobject_put() and add a
missing kobject_put() in the edac_device_register_sysfs_main_kobj()
error path.
[ bp: Massage and merge into a single patch. ]
Fixes: b2ed215a3338 ("Kobject: change drivers/edac to use kobject_init_and_add")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200528202238.18078-1-wu000273@umn.edu
Link: https://lkml.kernel.org/r/20200528203526.20908-1-wu000273@umn.edu
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions