Subject: CVE-2022-48780: net/smc: Avoid overwriting the copies of clcsock callback functions

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

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

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

net/smc: Avoid overwriting the copies of clcsock callback functions

The callback functions of clcsock will be saved and replaced during
the fallback. But if the fallback happens more than once, then the
copies of these callback functions will be overwritten incorrectly,
resulting in a loop call issue:

clcsk->sk_error_report
 |- smc_fback_error_report() <------------------------------|
     |- smc_fback_forward_wakeup()                          | (loop)
         |- clcsock_callback()  (incorrectly overwritten)   |
             |- smc->clcsk_error_report() ------------------|

So this patch fixes the issue by saving these function pointers only
once in the fallback and avoiding overwriting.

The Linux kernel CVE team has assigned CVE-2022-48780 to this issue.

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

	Issue introduced in 5.15.22 with commit 0ef6049f6649 and fixed in 5.15.25 with commit 7de7ba7a8bd4
	Issue introduced in 5.16.8 with commit 504078fbe9dd and fixed in 5.16.11 with commit f00b6c976ae0

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-2022-48780
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/smc/af_smc.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/7de7ba7a8bd4fde0141de8674c13514d0072f0e6
	https://git.kernel.org/stable/c/f00b6c976ae0dfbd9b891175f713f59095d23842
	https://git.kernel.org/stable/c/1de9770d121ee9294794cca0e0be8fbfa0134ee8