Subject: CVE-2024-44974: mptcp: pm: avoid possible UaF when selecting endp

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

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

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

mptcp: pm: avoid possible UaF when selecting endp

select_local_address() and select_signal_address() both select an
endpoint entry from the list inside an RCU protected section, but return
a reference to it, to be read later on. If the entry is dereferenced
after the RCU unlock, reading info could cause a Use-after-Free.

A simple solution is to copy the required info while inside the RCU
protected section to avoid any risk of UaF later. The address ID might
need to be modified later to handle the ID0 case later, so a copy seems
OK to deal with.

The Linux kernel CVE team has assigned CVE-2024-44974 to this issue.

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

	Issue introduced in 5.7 with commit 01cacb00b35c and fixed in 5.10.226 with commit ddee5b4b6a1c
	Issue introduced in 5.7 with commit 01cacb00b35c and fixed in 5.15.167 with commit f2c865e9e3ca
	Issue introduced in 5.7 with commit 01cacb00b35c and fixed in 6.1.109 with commit 2b4f46f95036
	Issue introduced in 5.7 with commit 01cacb00b35c and fixed in 6.6.48 with commit 9a9afbbc3fbf
	Issue introduced in 5.7 with commit 01cacb00b35c and fixed in 6.10.7 with commit 0201d65d9806
	Issue introduced in 5.7 with commit 01cacb00b35c and fixed in 6.11 with commit 48e50dcbcbaa

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-2024-44974
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/pm_netlink.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/ddee5b4b6a1cc03c1e9921cf34382e094c2009f1
	https://git.kernel.org/stable/c/f2c865e9e3ca44fc06b5f73b29a954775e4dbb38
	https://git.kernel.org/stable/c/2b4f46f9503633dade75cb796dd1949d0e6581a1
	https://git.kernel.org/stable/c/9a9afbbc3fbfca4975eea4aa5b18556db5a0c0b8
	https://git.kernel.org/stable/c/0201d65d9806d287a00e0ba96f0321835631f63f
	https://git.kernel.org/stable/c/48e50dcbcbaaf713d82bf2da5c16aeced94ad07d