Subject: CVE-2024-35805: dm snapshot: fix lockup in dm_exception_table_exit

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

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

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

dm snapshot: fix lockup in dm_exception_table_exit

There was reported lockup when we exit a snapshot with many exceptions.
Fix this by adding "cond_resched" to the loop that frees the exceptions.

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

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

	Fixed in 5.4.274 with commit e7d4cff57c3c
	Fixed in 5.10.215 with commit 9759ff196e7d
	Fixed in 5.15.154 with commit 116562e804ff
	Fixed in 6.1.84 with commit 3d47eb405781
	Fixed in 6.6.24 with commit e50f83061ac2
	Fixed in 6.7.12 with commit fa5c055800a7
	Fixed in 6.8.3 with commit 5f4ad4d0b094
	Fixed in 6.9 with commit 6e7132ed3c07

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-35805
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-snap.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/e7d4cff57c3c43fdd72342c78d4138f509c7416e
	https://git.kernel.org/stable/c/9759ff196e7d248bcf8386a7451d6ff8537a7d9c
	https://git.kernel.org/stable/c/116562e804ffc9dc600adab6326dde31d72262c7
	https://git.kernel.org/stable/c/3d47eb405781cc5127deca9a14e24b27696087a1
	https://git.kernel.org/stable/c/e50f83061ac250f90710757a3e51b70a200835e2
	https://git.kernel.org/stable/c/fa5c055800a7fd49a36bbb52593aca4ea986a366
	https://git.kernel.org/stable/c/5f4ad4d0b0943296287313db60b3f84df4aad683
	https://git.kernel.org/stable/c/6e7132ed3c07bd8a6ce3db4bb307ef2852b322dc