Subject: CVE-2024-26819: dm: limit the number of targets and parameter size area

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

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

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

dm: limit the number of targets and parameter size area

The kvmalloc function fails with a warning if the size is larger than
INT_MAX. The warning was triggered by a syscall testing robot.

In order to avoid the warning, this commit limits the number of targets to
1048576 and the size of the parameter area to 1073741824.

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

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

	Fixed in 5.10.210 with commit a891a0621e72
	Fixed in 5.15.149 with commit 888a0a46b80f
	Fixed in 6.1.79 with commit c5d83ac2bf6c
	Fixed in 6.6.18 with commit 438d19492b7f
	Fixed in 6.7.6 with commit cd70175481f6
	Fixed in 6.8 with commit bd504bcfec41

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-26819
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/md/dm-core.h
	drivers/md/dm-ioctl.c
	drivers/md/dm-table.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/a891a0621e725e85529985139cada8cb5a74a116
	https://git.kernel.org/stable/c/888a0a46b80fa37eacfe81faf47ba0b83876251d
	https://git.kernel.org/stable/c/c5d83ac2bf6ca668a39ffb1a576899a66153ba19
	https://git.kernel.org/stable/c/438d19492b7f002334573bae43276297eb234c80
	https://git.kernel.org/stable/c/cd70175481f63af31901dd463e44386f033c3f4c
	https://git.kernel.org/stable/c/bd504bcfec41a503b32054da5472904b404341a4