Subject: CVE-2023-52747: IB/hfi1: Restore allocated resources on failed copyout

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

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

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

IB/hfi1: Restore allocated resources on failed copyout

Fix a resource leak if an error occurs.

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

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

	Issue introduced in 4.15 with commit f404ca4c7ea8 and fixed in 4.19.273 with commit 00d9e212b8a3
	Issue introduced in 4.15 with commit f404ca4c7ea8 and fixed in 5.4.232 with commit 7896accedf5b
	Issue introduced in 4.15 with commit f404ca4c7ea8 and fixed in 5.10.168 with commit 79b595d95914
	Issue introduced in 4.15 with commit f404ca4c7ea8 and fixed in 5.15.94 with commit 9bae58d58b6b
	Issue introduced in 4.15 with commit f404ca4c7ea8 and fixed in 6.1.12 with commit 0a4f811f2e5d
	Issue introduced in 4.15 with commit f404ca4c7ea8 and fixed in 6.2 with commit 6601fc0d15ff

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-52747
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/infiniband/hw/hfi1/file_ops.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/00d9e212b8a39e6ffcf31b9d2e503d2bf6009d45
	https://git.kernel.org/stable/c/7896accedf5bf1277d2f305718e36dc8bac7e321
	https://git.kernel.org/stable/c/79b595d9591426156a9e0635a5b5115508a36fef
	https://git.kernel.org/stable/c/9bae58d58b6bb73b572356b31a62d2afc7378d12
	https://git.kernel.org/stable/c/0a4f811f2e5d07bbd0c9226f4afb0a1270a831ae
	https://git.kernel.org/stable/c/6601fc0d15ffc20654e39486f9bef35567106d68