Subject: CVE-2023-52667: net/mlx5e: fix a potential double-free in fs_any_create_groups

From: Greg Kroah-Hartman <[email-masked]>

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

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

net/mlx5e: fix a potential double-free in fs_any_create_groups

When kcalloc() for ft->g succeeds but kvzalloc() for in fails,
fs_any_create_groups() will free ft->g. However, its caller
fs_any_create_table() will free ft->g again through calling
mlx5e_destroy_flow_table(), which will lead to a double-free.
Fix this by setting ft->g to NULL in fs_any_create_groups().

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

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

	Issue introduced in 5.13 with commit 0f575c20bf06 and fixed in 5.15.149 with commit 72a729868592
	Issue introduced in 5.13 with commit 0f575c20bf06 and fixed in 6.1.76 with commit b2fa86b2aceb
	Issue introduced in 5.13 with commit 0f575c20bf06 and fixed in 6.6.15 with commit 2897c981ee63
	Issue introduced in 5.13 with commit 0f575c20bf06 and fixed in 6.7.3 with commit 65a4ade8a6d2
	Issue introduced in 5.13 with commit 0f575c20bf06 and fixed in 6.8 with commit aef855df7e1b

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-52667
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/mlx5/core/en/fs_tt_redirect.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/72a729868592752b5a294d27453da264106983b1
	https://git.kernel.org/stable/c/b2fa86b2aceb4bc9ada51cea90f61546d7512cbe
	https://git.kernel.org/stable/c/2897c981ee63e1be5e530b1042484626a10b26d8
	https://git.kernel.org/stable/c/65a4ade8a6d205979292e88beeb6a626ddbd4779
	https://git.kernel.org/stable/c/aef855df7e1bbd5aa4484851561211500b22707e