CVE-2022-50669: misc: ocxl: fix possible name leak in ocxl_file_register_afu()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
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().
The Linux kernel CVE team has assigned CVE-2022-50669 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.2 with commit 75ca758adbafc81804c39b2c200ecdc819a6c042 and fixed in 5.4.229 with commit 0cd05062371a49774e8a45258bdedf0bd6d3d327 Issue introduced in 5.2 with commit 75ca758adbafc81804c39b2c200ecdc819a6c042 and fixed in 5.10.163 with commit 7525741cb302a1672b8c3a5edb2a08e4229b5c7c Issue introduced in 5.2 with commit 75ca758adbafc81804c39b2c200ecdc819a6c042 and fixed in 5.15.86 with commit 3299983a6bf628249ac650908e62d12de959341e Issue introduced in 5.2 with commit 75ca758adbafc81804c39b2c200ecdc819a6c042 and fixed in 6.0.16 with commit 557b7de055d1e230ddb6664c29d26917b8db9143 Issue introduced in 5.2 with commit 75ca758adbafc81804c39b2c200ecdc819a6c042 and fixed in 6.1.2 with commit 2fce8b3583d1641a1716486f408478b58e96ec91 Issue introduced in 5.2 with commit 75ca758adbafc81804c39b2c200ecdc819a6c042 and fixed in 6.2 with commit a4cb1004aeed2ab893a058fad00a5b41a12c4691
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2022-50669
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
drivers/misc/ocxl/file.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/0cd05062371a49774e8a45258bdedf0bd6d3d327 https://git.kernel.org/stable/c/7525741cb302a1672b8c3a5edb2a08e4229b5c7c https://git.kernel.org/stable/c/3299983a6bf628249ac650908e62d12de959341e https://git.kernel.org/stable/c/557b7de055d1e230ddb6664c29d26917b8db9143 https://git.kernel.org/stable/c/2fce8b3583d1641a1716486f408478b58e96ec91 https://git.kernel.org/stable/c/a4cb1004aeed2ab893a058fad00a5b41a12c4691