Subject: CVE-2023-52807: net: hns3: fix out-of-bounds access may occur when coalesce info is read via debugfs

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

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

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

net: hns3: fix out-of-bounds access may occur when coalesce info is read via debugfs

The hns3 driver define an array of string to show the coalesce
info, but if the kernel adds a new mode or a new state,
out-of-bounds access may occur when coalesce info is read via
debugfs, this patch fix the problem.

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

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

	Issue introduced in 5.16 with commit c99fead7cb07 and fixed in 6.1.64 with commit 07f5b8c47152
	Issue introduced in 5.16 with commit c99fead7cb07 and fixed in 6.5.13 with commit be1f703f39ef
	Issue introduced in 5.16 with commit c99fead7cb07 and fixed in 6.6.3 with commit f79d985c6906
	Issue introduced in 5.16 with commit c99fead7cb07 and fixed in 6.7 with commit 53aba458f238

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-52807
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/hns3_debugfs.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/07f5b8c47152cadbd9102e053dcb60685820aa09
	https://git.kernel.org/stable/c/be1f703f39efa27b7371b9a4cd983317f1366792
	https://git.kernel.org/stable/c/f79d985c69060047426be68b7e4c1663d5d731b4
	https://git.kernel.org/stable/c/53aba458f23846112c0d44239580ff59bc5c36c3