Subject: CVE-2024-40990: RDMA/mlx5: Add check for srq max_sge attribute

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

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

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

RDMA/mlx5: Add check for srq max_sge attribute

max_sge attribute is passed by the user, and is inserted and used
unchecked, so verify that the value doesn't exceed maximum allowed value
before using it.

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

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

	Issue introduced in 3.11 with commit e126ba97dba9 and fixed in 5.10.221 with commit 7186b81c1f15
	Issue introduced in 3.11 with commit e126ba97dba9 and fixed in 5.15.162 with commit 1e692244bf7d
	Issue introduced in 3.11 with commit e126ba97dba9 and fixed in 6.1.96 with commit 999586418600
	Issue introduced in 3.11 with commit e126ba97dba9 and fixed in 6.6.36 with commit e0deb0e9c967
	Issue introduced in 3.11 with commit e126ba97dba9 and fixed in 6.9.7 with commit 4ab99e361313
	Issue introduced in 3.11 with commit e126ba97dba9 and fixed in 6.10 with commit 36ab7ada64ca

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-40990
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/hw/mlx5/srq.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/7186b81c1f15e39069b1af172c6a951728ed3511
	https://git.kernel.org/stable/c/1e692244bf7dd827dd72edc6c4a3b36ae572f03c
	https://git.kernel.org/stable/c/999586418600b4b3b93c2a0edd3a4ca71ee759bf
	https://git.kernel.org/stable/c/e0deb0e9c967b61420235f7f17a4450b4b4d6ce2
	https://git.kernel.org/stable/c/4ab99e3613139f026d2d8ba954819e2876120ab3
	https://git.kernel.org/stable/c/36ab7ada64caf08f10ee5a114d39964d1f91e81d