Subject: CVE-2024-49864: rxrpc: Fix a race between socket set up and I/O thread creation

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

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

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

rxrpc: Fix a race between socket set up and I/O thread creation

In rxrpc_open_socket(), it sets up the socket and then sets up the I/O
thread that will handle it.  This is a problem, however, as there's a gap
between the two phases in which a packet may come into rxrpc_encap_rcv()
from the UDP packet but we oops when trying to wake the not-yet created I/O
thread.

As a quick fix, just make rxrpc_encap_rcv() discard the packet if there's
no I/O thread yet.

A better, but more intrusive fix would perhaps be to rearrange things such
that the socket creation is done by the I/O thread.

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

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

	Issue introduced in 6.2 with commit a275da62e8c1 and fixed in 6.6.55 with commit cdf4bbbdb956
	Issue introduced in 6.2 with commit a275da62e8c1 and fixed in 6.10.14 with commit 56e415202b8a
	Issue introduced in 6.2 with commit a275da62e8c1 and fixed in 6.11.3 with commit c64f5fc95e96
	Issue introduced in 6.2 with commit a275da62e8c1 and fixed in 6.12-rc3 with commit bc212465326e

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-49864
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/ar-internal.h
	net/rxrpc/io_thread.c
	net/rxrpc/local_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/cdf4bbbdb956d7426f687f38757ebca2a2759a0f
	https://git.kernel.org/stable/c/56e415202b8a17de6496f4023e545fcb66f118ec
	https://git.kernel.org/stable/c/c64f5fc95e9612fdf75587c8e21e494e614c18e2
	https://git.kernel.org/stable/c/bc212465326e8587325f520a052346f0b57360e6