Subject: CVE-2024-27046: nfp: flower: handle acti_netdevs allocation failure

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

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

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

nfp: flower: handle acti_netdevs allocation failure

The kmalloc_array() in nfp_fl_lag_do_work() will return null, if
the physical memory has run out. As a result, if we dereference
the acti_netdevs, the null pointer dereference bugs will happen.

This patch adds a check to judge whether allocation failure occurs.
If it happens, the delayed work will be rescheduled and try again.

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

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

	Issue introduced in 4.18 with commit bb9a8d031140 and fixed in 4.19.311 with commit d746889db75a
	Issue introduced in 4.18 with commit bb9a8d031140 and fixed in 5.4.273 with commit 3b1e8a617eb0
	Issue introduced in 4.18 with commit bb9a8d031140 and fixed in 5.10.214 with commit 928705e34101
	Issue introduced in 4.18 with commit bb9a8d031140 and fixed in 5.15.153 with commit 0d387dc503f9
	Issue introduced in 4.18 with commit bb9a8d031140 and fixed in 6.1.83 with commit c9b4e220dd18
	Issue introduced in 4.18 with commit bb9a8d031140 and fixed in 6.6.23 with commit 408ba7fd04f9
	Issue introduced in 4.18 with commit bb9a8d031140 and fixed in 6.7.11 with commit c8df9203bf22
	Issue introduced in 4.18 with commit bb9a8d031140 and fixed in 6.8.2 with commit 9d8eb1238377
	Issue introduced in 4.18 with commit bb9a8d031140 and fixed in 6.9 with commit 84e95149bd34

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-27046
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/netronome/nfp/flower/lag_conf.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/d746889db75a76aeee95fb705b8e1ac28c684a2e
	https://git.kernel.org/stable/c/3b1e8a617eb0f4cdc19def530047a95b5abde07d
	https://git.kernel.org/stable/c/928705e341010dd910fdece61ccb974f494a758f
	https://git.kernel.org/stable/c/0d387dc503f9a53e6d1f6e9dd0292d38f083eba5
	https://git.kernel.org/stable/c/c9b4e220dd18f79507803f38a55d53b483f6c9c3
	https://git.kernel.org/stable/c/408ba7fd04f959c61b50db79c983484312fea642
	https://git.kernel.org/stable/c/c8df9203bf22c66fa26e8d8c7f8ce181cf88099d
	https://git.kernel.org/stable/c/9d8eb1238377cd994829f9162ae396a84ae037b2
	https://git.kernel.org/stable/c/84e95149bd341705f0eca6a7fcb955c548805002