Subject: CVE-2021-47485: IB/qib: Protect from buffer overflow in struct qib_user_sdma_pkt fields

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

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

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

IB/qib: Protect from buffer overflow in struct qib_user_sdma_pkt fields

Overflowing either addrlimit or bytes_togo can allow userspace to trigger
a buffer overflow of kernel memory. Check for overflows in all the places
doing math on user controlled buffers.

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

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

	Issue introduced in 2.6.35 with commit f931551bafe1 and fixed in 4.4.292 with commit bda41654b6e0
	Issue introduced in 2.6.35 with commit f931551bafe1 and fixed in 4.9.290 with commit 3f57c3f67fd9
	Issue introduced in 2.6.35 with commit f931551bafe1 and fixed in 4.14.255 with commit 60833707b968
	Issue introduced in 2.6.35 with commit f931551bafe1 and fixed in 4.19.216 with commit 73d2892148aa
	Issue introduced in 2.6.35 with commit f931551bafe1 and fixed in 5.4.157 with commit 0f8cdfff0682
	Issue introduced in 2.6.35 with commit f931551bafe1 and fixed in 5.10.77 with commit c3e17e58f571
	Issue introduced in 2.6.35 with commit f931551bafe1 and fixed in 5.14.16 with commit 0d4395477741
	Issue introduced in 2.6.35 with commit f931551bafe1 and fixed in 5.15 with commit d39bf40e55e6

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-47485
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/bda41654b6e0c125a624ca35d6d20beb8015b5d0
	https://git.kernel.org/stable/c/3f57c3f67fd93b4da86aeffea1ca32c484d054ad
	https://git.kernel.org/stable/c/60833707b968d5ae02a75edb7886dcd4a957cf0d
	https://git.kernel.org/stable/c/73d2892148aa4397a885b4f4afcfc5b27a325c42
	https://git.kernel.org/stable/c/0f8cdfff06829a0b0348b6debc29ff6a61967724
	https://git.kernel.org/stable/c/c3e17e58f571f34c51aeb17274ed02c2ed5cf780
	https://git.kernel.org/stable/c/0d4395477741608d123dad51def9fe50b7ebe952
	https://git.kernel.org/stable/c/d39bf40e55e666b5905fdbd46a0dced030ce87be