Subject: CVE-2024-36900: net: hns3: fix kernel crash when devlink reload during initialization

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

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

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

net: hns3: fix kernel crash when devlink reload during initialization

The devlink reload process will access the hardware resources,
but the register operation is done before the hardware is initialized.
So, processing the devlink reload during initialization may lead to kernel
crash.

This patch fixes this by registering the devlink after
hardware initialization.

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

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

	Issue introduced in 5.15 with commit cd6242991d2e and fixed in 6.1.91 with commit 72ede790f5a0
	Issue introduced in 5.15 with commit cd6242991d2e and fixed in 6.6.31 with commit 5c623fe05348
	Issue introduced in 5.15 with commit cd6242991d2e and fixed in 6.8.10 with commit c98bc78ce090
	Issue introduced in 5.15 with commit cd6242991d2e and fixed in 6.9 with commit 35d92abfbad8

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-36900
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/hisilicon/hns3/hns3pf/hclge_main.c
	drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.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/72ede790f5a03c3957487400a1b72ebce293a2e7
	https://git.kernel.org/stable/c/5c623fe0534806b627054da09b6f51b7b2f7b9cd
	https://git.kernel.org/stable/c/c98bc78ce0909ccc92005e2cb6609ec6c7942f69
	https://git.kernel.org/stable/c/35d92abfbad88cf947c010baf34b075e40566095