Subject: CVE-2021-47001: xprtrdma: Fix cwnd update ordering

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

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

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

xprtrdma: Fix cwnd update ordering

After a reconnect, the reply handler is opening the cwnd (and thus
enabling more RPC Calls to be sent) /before/ rpcrdma_post_recvs()
can post enough Receive WRs to receive their replies. This causes an
RNR and the new connection is lost immediately.

The race is most clearly exposed when KASAN and disconnect injection
are enabled. This slows down rpcrdma_rep_create() enough to allow
the send side to post a bunch of RPC Calls before the Receive
completion handler can invoke ib_post_recv().

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

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

	Issue introduced in 5.5 with commit 2ae50ad68cd7 and fixed in 5.10.38 with commit eddae8be7944
	Issue introduced in 5.5 with commit 2ae50ad68cd7 and fixed in 5.11.22 with commit 8834ecb5df22
	Issue introduced in 5.5 with commit 2ae50ad68cd7 and fixed in 5.12.5 with commit 19b5fa9489b5
	Issue introduced in 5.5 with commit 2ae50ad68cd7 and fixed in 5.13 with commit 35d8b10a2588
	Issue introduced in 5.4.13 with commit 3791c5982ba1

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-47001
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/sunrpc/xprtrdma/rpc_rdma.c
	net/sunrpc/xprtrdma/verbs.c
	net/sunrpc/xprtrdma/xprt_rdma.h

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/eddae8be7944096419c2ae29477a45f767d0fcd4
	https://git.kernel.org/stable/c/8834ecb5df22b7ff3c9b0deba7726579bb613f95
	https://git.kernel.org/stable/c/19b5fa9489b5706bc878c3a522a7f771079e2fa0
	https://git.kernel.org/stable/c/35d8b10a25884050bb3b0149b62c3818ec59f77c