Subject: CVE-2022-49025: net/mlx5e: Fix use-after-free when reverting termination table

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

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

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

net/mlx5e: Fix use-after-free when reverting termination table

When having multiple dests with termination tables and second one
or afterwards fails the driver reverts usage of term tables but
doesn't reset the assignment in attr->dests[num_vport_dests].termtbl
which case a use-after-free when releasing the rule.
Fix by resetting the assignment of termtbl to null.

The Linux kernel CVE team has assigned CVE-2022-49025 to this issue.

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

	Issue introduced in 5.3 with commit 10caabdaad5a and fixed in 5.4.226 with commit 0a2d73a77060
	Issue introduced in 5.3 with commit 10caabdaad5a and fixed in 5.10.158 with commit 0d2f9d95d9fb
	Issue introduced in 5.3 with commit 10caabdaad5a and fixed in 5.15.82 with commit 372eb550faa0
	Issue introduced in 5.3 with commit 10caabdaad5a and fixed in 6.0.12 with commit e6d2d26a49c3
	Issue introduced in 5.3 with commit 10caabdaad5a and fixed in 6.1 with commit 52c795af0444

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-49025
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/eswitch_offloads_termtbl.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/0a2d73a77060c3cbdc6e801cd5d979d674cd404b
	https://git.kernel.org/stable/c/0d2f9d95d9fbe993f3c4bafb87d59897b0325aff
	https://git.kernel.org/stable/c/372eb550faa0757349040fd43f59483cbfdb2c0b
	https://git.kernel.org/stable/c/e6d2d26a49c3a9cd46b232975e45236304810904
	https://git.kernel.org/stable/c/52c795af04441d76f565c4634f893e5b553df2ae