diff options
author | Kees Cook <[email protected]> | 2018-09-28 15:17:50 -0700 |
---|---|---|
committer | Kees Cook <[email protected]> | 2018-09-30 10:15:41 -0700 |
commit | bac6f6cda206ad7cbe0c73c35e494377ce9c4749 (patch) | |
tree | baf7c12f5ba0069ea47da897a8be25f43fc5ab2c /include/linux/fpga/fpga-mgr.h | |
parent | 831b624df1b420c8f9281ed1307a8db23afb72df (diff) |
pstore/ram: Fix failure-path memory leak in ramoops_init
As reported by nixiaoming, with some minor clarifications:
1) memory leak in ramoops_register_dummy():
dummy_data = kzalloc(sizeof(*dummy_data), GFP_KERNEL);
but no kfree() if platform_device_register_data() fails.
2) memory leak in ramoops_init():
Missing platform_device_unregister(dummy) and kfree(dummy_data)
if platform_driver_register(&ramoops_driver) fails.
I've clarified the purpose of ramoops_register_dummy(), and added a
common cleanup routine for all three failure paths to call.
Reported-by: nixiaoming <[email protected]>
Cc: [email protected]
Cc: Anton Vorontsov <[email protected]>
Cc: Colin Cross <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Joel Fernandes <[email protected]>
Cc: Geliang Tang <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Diffstat (limited to 'include/linux/fpga/fpga-mgr.h')
0 files changed, 0 insertions, 0 deletions