diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2022-11-11 22:59:29 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-11-23 19:49:17 +0100 |
commit | a4cb1004aeed2ab893a058fad00a5b41a12c4691 (patch) | |
tree | 2fd38aa061bc5b875aa242428f9bcea12ab09b4b /drivers/misc/ocxl/config.c | |
parent | 7610615e8cdb3f6f5bbd9d8e7a5d8a63e3cabf2e (diff) | |
download | linux-a4cb1004aeed2ab893a058fad00a5b41a12c4691.tar.gz linux-a4cb1004aeed2ab893a058fad00a5b41a12c4691.tar.bz2 linux-a4cb1004aeed2ab893a058fad00a5b41a12c4691.zip |
misc: ocxl: fix possible name leak in ocxl_file_register_afu()
If device_register() returns error in ocxl_file_register_afu(),
the name allocated by dev_set_name() need be freed. As comment
of device_register() says, it should use put_device() to give
up the reference in the error path. So fix this by calling
put_device(), then the name can be freed in kobject_cleanup(),
and info is freed in info_release().
Fixes: 75ca758adbaf ("ocxl: Create a clear delineation between ocxl backend & frontend")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>
Link: https://lore.kernel.org/r/20221111145929.2429271-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/ocxl/config.c')
0 files changed, 0 insertions, 0 deletions