Subject: CVE-2021-47581: xen/netback: don't queue unlimited number of packages

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

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

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

xen/netback: don't queue unlimited number of packages

In case a guest isn't consuming incoming network traffic as fast as it
is coming in, xen-netback is buffering network packages in unlimited
numbers today. This can result in host OOM situations.

Commit f48da8b14d04ca8 ("xen-netback: fix unlimited guest Rx internal
queue and carrier flapping") meant to introduce a mechanism to limit
the amount of buffered data by stopping the Tx queue when reaching the
data limit, but this doesn't work for cases like UDP.

When hitting the limit don't queue further SKBs, but drop them instead.
In order to be able to tell Rx packages have been dropped increment the
rx_dropped statistics counter in this case.

It should be noted that the old solution to continue queueing SKBs had
the additional problem of an overflow of the 32-bit rx_queue_len value
would result in intermittent Tx queue enabling.

This is part of XSA-392

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

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

	Issue introduced in 3.18 with commit f48da8b14d04 and fixed in 4.4.296 with commit 0928efb09178
	Issue introduced in 3.18 with commit f48da8b14d04 and fixed in 4.9.294 with commit b4226b387436
	Issue introduced in 3.18 with commit f48da8b14d04 and fixed in 4.14.259 with commit 9bebb2eedf67
	Issue introduced in 3.18 with commit f48da8b14d04 and fixed in 4.19.222 with commit c9f17e92917f
	Issue introduced in 3.18 with commit f48da8b14d04 and fixed in 5.4.168 with commit 0d99b3c6bd39
	Issue introduced in 3.18 with commit f48da8b14d04 and fixed in 5.10.88 with commit 88f20cccbeec
	Issue introduced in 3.18 with commit f48da8b14d04 and fixed in 5.15.11 with commit bd926d189210
	Issue introduced in 3.18 with commit f48da8b14d04 and fixed in 5.16 with commit be81992f9086

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-47581
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/xen-netback/rx.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/0928efb09178e01d3dc8e8849aa1c807436c3c37
	https://git.kernel.org/stable/c/b4226b387436315e7f57465c15335f4f4b5b075d
	https://git.kernel.org/stable/c/9bebb2eedf679b3be4acaa20efda97f32c999d74
	https://git.kernel.org/stable/c/c9f17e92917fd5786be872626a3928979ecc4c39
	https://git.kernel.org/stable/c/0d99b3c6bd39a0a023e972d8f912fd47698bbbb8
	https://git.kernel.org/stable/c/88f20cccbeec9a5e83621df5cc2453b5081454dc
	https://git.kernel.org/stable/c/bd926d189210cd1d5b4e618e45898053be6b4b3b
	https://git.kernel.org/stable/c/be81992f9086b230623ae3ebbc85ecee4d00a3d3