Subject: CVE-2021-47168: NFS: fix an incorrect limit in filelayout_decode_layout()

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

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

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

NFS: fix an incorrect limit in filelayout_decode_layout()

The "sizeof(struct nfs_fh)" is two bytes too large and could lead to
memory corruption.  It should be NFS_MAXFHSIZE because that's the size
of the ->data[] buffer.

I reversed the size of the arguments to put the variable on the left.

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

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

	Issue introduced in 2.6.37 with commit 16b374ca439f and fixed in 4.4.271 with commit 9d280ab53df1
	Issue introduced in 2.6.37 with commit 16b374ca439f and fixed in 4.9.271 with commit b287521e9e94
	Issue introduced in 2.6.37 with commit 16b374ca439f and fixed in 4.14.235 with commit f299522eda15
	Issue introduced in 2.6.37 with commit 16b374ca439f and fixed in 4.19.193 with commit 945ebef99722
	Issue introduced in 2.6.37 with commit 16b374ca439f and fixed in 5.4.124 with commit e411df81cd86
	Issue introduced in 2.6.37 with commit 16b374ca439f and fixed in 5.10.42 with commit 9b367fe770b1
	Issue introduced in 2.6.37 with commit 16b374ca439f and fixed in 5.12.9 with commit d34fb628f6ef
	Issue introduced in 2.6.37 with commit 16b374ca439f and fixed in 5.13 with commit 769b01ea68b6

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-47168
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/filelayout/filelayout.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/9d280ab53df1d4a1043bd7a9e7c6a2f9cfbfe040
	https://git.kernel.org/stable/c/b287521e9e94bb342ebe5fd8c3fd7db9aef4e6f1
	https://git.kernel.org/stable/c/f299522eda1566cbfbae4b15c82970fc41b03714
	https://git.kernel.org/stable/c/945ebef997227ca8c20bad7f8a8358c8ee57a84a
	https://git.kernel.org/stable/c/e411df81cd862ef3d5b878120b2a2fef0ca9cdb1
	https://git.kernel.org/stable/c/9b367fe770b1b80d7bf64ed0d177544a44405f6e
	https://git.kernel.org/stable/c/d34fb628f6ef522f996205a9e578216bbee09e84
	https://git.kernel.org/stable/c/769b01ea68b6c49dc3cde6adf7e53927dacbd3a8