Subject: CVE-2021-47152: mptcp: fix data stream corruption

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

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

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

mptcp: fix data stream corruption

Maxim reported several issues when forcing a TCP transparent proxy
to use the MPTCP protocol for the inbound connections. He also
provided a clean reproducer.

The problem boils down to 'mptcp_frag_can_collapse_to()' assuming
that only MPTCP will use the given page_frag.

If others - e.g. the plain TCP protocol - allocate page fragments,
we can end-up re-using already allocated memory for mptcp_data_frag.

Fix the issue ensuring that the to-be-expanded data fragment is
located at the current page frag end.

v1 -> v2:
 - added missing fixes tag (Mat)

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

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

	Issue introduced in 5.7 with commit 18b683bff89d and fixed in 5.10.42 with commit 3267a061096e
	Issue introduced in 5.7 with commit 18b683bff89d and fixed in 5.12.9 with commit 18e7f0580da1
	Issue introduced in 5.7 with commit 18b683bff89d and fixed in 5.13 with commit 29249eac5225

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-47152
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:
	net/mptcp/protocol.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/3267a061096efc91eda52c2a0c61ba76e46e4b34
	https://git.kernel.org/stable/c/18e7f0580da15cac1e79d73683ada5a9e70980f8
	https://git.kernel.org/stable/c/29249eac5225429b898f278230a6ca2baa1ae154