Subject: CVE-2024-50062: RDMA/rtrs-srv: Avoid null pointer deref during path establishment

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

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

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

RDMA/rtrs-srv: Avoid null pointer deref during path establishment

For RTRS path establishment, RTRS client initiates and completes con_num
of connections. After establishing all its connections, the information
is exchanged between the client and server through the info_req message.
During this exchange, it is essential that all connections have been
established, and the state of the RTRS srv path is CONNECTED.

So add these sanity checks, to make sure we detect and abort process in
error scenarios to avoid null pointer deref.

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

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

	Fixed in 5.15.168 with commit 394b2f4d5e01
	Fixed in 6.1.113 with commit b5d407666446
	Fixed in 6.6.57 with commit ccb8e44ae3e2
	Fixed in 6.11.4 with commit b720792d7e85
	Fixed in 6.12-rc1 with commit d0e62bf7b575

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-50062
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:
	drivers/infiniband/ulp/rtrs/rtrs-srv.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/394b2f4d5e014820455af3eb5859eb328eaafcfd
	https://git.kernel.org/stable/c/b5d4076664465487a9a3d226756995b12fb73d71
	https://git.kernel.org/stable/c/ccb8e44ae3e2391235f80ffc6be59bec6b889ead
	https://git.kernel.org/stable/c/b720792d7e8515bc695752e0ed5884e2ea34d12a
	https://git.kernel.org/stable/c/d0e62bf7b575fbfe591f6f570e7595dd60a2f5eb