Subject: CVE-2021-47538: rxrpc: Fix rxrpc_local leak in rxrpc_lookup_peer()

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

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

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

rxrpc: Fix rxrpc_local leak in rxrpc_lookup_peer()

Need to call rxrpc_put_local() for peer candidate before kfree() as it
holds a ref to rxrpc_local.

[DH: v2: Changed to abstract the peer freeing code out into a function]

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

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

	Issue introduced in 4.19.82 with commit e8e51ce79c15 and fixed in 4.19.220 with commit 913c24af2d13
	Issue introduced in 5.4 with commit 9ebeddef58c4 and fixed in 5.4.164 with commit 3e70e3a72d80
	Issue introduced in 5.4 with commit 9ebeddef58c4 and fixed in 5.10.84 with commit 60f0b9c42cb8
	Issue introduced in 5.4 with commit 9ebeddef58c4 and fixed in 5.15.7 with commit 9469273e616c
	Issue introduced in 5.4 with commit 9ebeddef58c4 and fixed in 5.16 with commit beacff50edbd
	Issue introduced in 5.3.9 with commit 9b7fc03b4cdb

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-47538
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/rxrpc/peer_object.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/913c24af2d13a3fd304462916ee98e298d56bdce
	https://git.kernel.org/stable/c/3e70e3a72d80b16094faccbe438cd53761c3503a
	https://git.kernel.org/stable/c/60f0b9c42cb80833a03ca57c1c8b078d716e71d1
	https://git.kernel.org/stable/c/9469273e616ca8f1b6e3773c5019f21b4c8d828c
	https://git.kernel.org/stable/c/beacff50edbd6c9659a6f15fc7f6126909fade29