Skip to contentSkip to conversation

CVE-2023-52652: NTB: fix possible name leak in ntb_register_device()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message May 1, 2024

lore
Share & tools
lore
#0 lore raw

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

NTB: fix possible name leak in ntb_register_device()

If device_register() fails in ntb_register_device(), the device name allocated by dev_set_name() should be freed. As per the comment in device_register(), callers should use put_device() to give up the reference in the error path. So fix this by calling put_device() in the error path so that the name can be freed in kobject_cleanup().

As a result of this, put_device() in the error path of ntb_register_device() is removed and the actual error is returned.

[mani: reworded commit message]

The Linux kernel CVE team has assigned CVE-2023-52652 to this issue.

Affected and fixed versions
===========================

Issue introduced in 4.2 with commit a1bd3baeb2f1 and fixed in 5.15.153 with commit a62b9f3d7bbf Issue introduced in 4.2 with commit a1bd3baeb2f1 and fixed in 6.1.83 with commit 6632a54ac805 Issue introduced in 4.2 with commit a1bd3baeb2f1 and fixed in 6.6.23 with commit a039690d3232 Issue introduced in 4.2 with commit a1bd3baeb2f1 and fixed in 6.7.11 with commit e8025439ef8e Issue introduced in 4.2 with commit a1bd3baeb2f1 and fixed in 6.8.2 with commit 913421f9f7fd Issue introduced in 4.2 with commit a1bd3baeb2f1 and fixed in 6.9-rc1 with commit aebfdfe39b93

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-2023-52652

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/ntb/core.c drivers/pci/endpoint/functions/pci-epf-vntb.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/a62b9f3d7bbfac874cc0c638bc1776dcf1f8ec06
	https://git.kernel.org/stable/c/6632a54ac8057cc0b0d789c6f73883e871bcd25c
	https://git.kernel.org/stable/c/a039690d323221eb5865f1f31db3ec264e7a14b6
	https://git.kernel.org/stable/c/e8025439ef8e16029dc313d78a351ef192469b7b
	https://git.kernel.org/stable/c/913421f9f7fd8324dcc41753d0f28b52e177ef04
	https://git.kernel.org/stable/c/aebfdfe39b9327a3077d0df8db3beb3160c9bdd0