Subject: CVE-2021-47104: IB/qib: Fix memory leak in qib_user_sdma_queue_pkts()

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

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

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

IB/qib: Fix memory leak in qib_user_sdma_queue_pkts()

The wrong goto label was used for the error case and missed cleanup of the
pkt allocation.

Addresses-Coverity-ID: 1493352 ("Resource leak")

The Linux kernel CVE team has assigned CVE-2021-47104 to this issue.

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

	Issue introduced in 4.4.292 with commit bda41654b6e0 and fixed in 4.4.297 with commit 1ced0a3015a9
	Issue introduced in 4.9.290 with commit 3f57c3f67fd9 and fixed in 4.9.295 with commit 76b648063eb3
	Issue introduced in 4.14.255 with commit 60833707b968 and fixed in 4.14.260 with commit d53456492b5d
	Issue introduced in 4.19.216 with commit 73d2892148aa and fixed in 4.19.223 with commit 0aaec9c5f607
	Issue introduced in 5.4.157 with commit 0f8cdfff0682 and fixed in 5.4.169 with commit 79dcbd817615
	Issue introduced in 5.10.77 with commit c3e17e58f571 and fixed in 5.10.89 with commit 7cf6466e00a7
	Issue introduced in 5.15 with commit d39bf40e55e6 and fixed in 5.15.12 with commit aefcc25f3a0c
	Issue introduced in 5.15 with commit d39bf40e55e6 and fixed in 5.16 with commit bee90911e013
	Issue introduced in 5.14.16 with commit 0d4395477741

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-2021-47104
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/qib/qib_user_sdma.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/1ced0a3015a95c6a6db45e37250912c4c86697ab
	https://git.kernel.org/stable/c/76b648063eb36c72dfc0a6896de8a0a7d2c7841c
	https://git.kernel.org/stable/c/d53456492b5d02033c73dfa0f3b94c86337791ba
	https://git.kernel.org/stable/c/0aaec9c5f60754b56f84460ea439b8c5e91f4caa
	https://git.kernel.org/stable/c/79dcbd8176152b860028b62f81a635d987365752
	https://git.kernel.org/stable/c/7cf6466e00a77b0a914b7b2c28a1fc7947d55e59
	https://git.kernel.org/stable/c/aefcc25f3a0cd28a87d11d41d30419a12cd26a34
	https://git.kernel.org/stable/c/bee90911e0138c76ee67458ac0d58b38a3190f65