Subject: CVE-2021-47167: NFS: Fix an Oopsable condition in __nfs_pageio_add_request()

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

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

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

NFS: Fix an Oopsable condition in __nfs_pageio_add_request()

Ensure that nfs_pageio_error_cleanup() resets the mirror array contents,
so that the structure reflects the fact that it is now empty.
Also change the test in nfs_pageio_do_add_request() to be more robust by
checking whether or not the list is empty rather than relying on the
value of pg_count.

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

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

	Issue introduced in 4.0 with commit a7d42ddb3099 and fixed in 5.4.124 with commit 1fc5f4eb9d31
	Issue introduced in 4.0 with commit a7d42ddb3099 and fixed in 5.10.42 with commit ee21cd3aa854
	Issue introduced in 4.0 with commit a7d42ddb3099 and fixed in 5.12.9 with commit 15ac6f147876
	Issue introduced in 4.0 with commit a7d42ddb3099 and fixed in 5.13 with commit 56517ab958b7

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-47167
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:
	fs/nfs/pagelist.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/1fc5f4eb9d31268ac3ce152d74ad5501ad24ca3e
	https://git.kernel.org/stable/c/ee21cd3aa8548e0cbc8c67a80b62113aedd2d101
	https://git.kernel.org/stable/c/15ac6f14787649e8ebd75c142e2c5d2a243c8490
	https://git.kernel.org/stable/c/56517ab958b7c11030e626250c00b9b1a24b41eb