Subject: CVE-2024-36021: net: hns3: fix kernel crash when devlink reload during pf 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 pf 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 taking devl_lock during initialization.

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

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

	Issue introduced in 5.15 with commit b741269b2759 and fixed in 6.1.85 with commit 50b69054f455
	Issue introduced in 5.15 with commit b741269b2759 and fixed in 6.6.26 with commit 1b550dae5590
	Issue introduced in 5.15 with commit b741269b2759 and fixed in 6.8.5 with commit 7ca0f73e5e2d
	Issue introduced in 5.15 with commit b741269b2759 and fixed in 6.9 with commit 93305b77ffcb

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-36021
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

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/50b69054f455dcdb34bd6b22764c7579b270eef3
	https://git.kernel.org/stable/c/1b550dae55901c2cc9075d6a7155a71b4f516e86
	https://git.kernel.org/stable/c/7ca0f73e5e2da3c129935b97f3a0877cce8ebdf5
	https://git.kernel.org/stable/c/93305b77ffcb042f1538ecc383505e87d95aa05a