Skip to contentSkip to conversation

CVE-2024-42138: mlxsw: core_linecards: Fix double memory deallocation in case of invalid INI file

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jul 30, 2024

lore
Share & tools
lore
#0 lore raw

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

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

mlxsw: core_linecards: Fix double memory deallocation in case of invalid INI file

In case of invalid INI file mlxsw_linecard_types_init() deallocates memory but doesn't reset pointer to NULL and returns 0. In case of any error occurred after mlxsw_linecard_types_init() call, mlxsw_linecards_init() calls mlxsw_linecard_types_fini() which performs memory deallocation again.

Add pointer reset to NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

The Linux kernel CVE team has assigned CVE-2024-42138 to this issue.

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

	Issue introduced in 5.19 with commit b217127e5e4e and fixed in 6.1.98 with commit ab557f5cd993
	Issue introduced in 5.19 with commit b217127e5e4e and fixed in 6.6.39 with commit f8b55a465b0e
	Issue introduced in 5.19 with commit b217127e5e4e and fixed in 6.9.9 with commit 9af7437669b7
	Issue introduced in 5.19 with commit b217127e5e4e and fixed in 6.10 with commit 8ce34dccbe8f

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-2024-42138

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/net/ethernet/mellanox/mlxsw/core_linecards.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/ab557f5cd993a3201b09593633d04b891263d5c0
	https://git.kernel.org/stable/c/f8b55a465b0e8a500179808166fe9420f5c091a1
	https://git.kernel.org/stable/c/9af7437669b72f804fc4269f487528dbbed142a2
	https://git.kernel.org/stable/c/8ce34dccbe8fa7d2ef86f2d8e7db2a9b67cabfc3