Subject: CVE-2024-47739: padata: use integer wrap around to prevent deadlock on seq_nr overflow

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

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

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

padata: use integer wrap around to prevent deadlock on seq_nr overflow

When submitting more than 2^32 padata objects to padata_do_serial, the
current sorting implementation incorrectly sorts padata objects with
overflowed seq_nr, causing them to be placed before existing objects in
the reorder list. This leads to a deadlock in the serialization process
as padata_find_next cannot match padata->seq_nr and pd->processed
because the padata instance with overflowed seq_nr will be selected
next.

To fix this, we use an unsigned integer wrap around to correctly sort
padata objects in scenarios with integer overflow.

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

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

	Issue introduced in 5.4 with commit bfde23ce200e and fixed in 5.10.227 with commit 46c4079460f4
	Issue introduced in 5.4 with commit bfde23ce200e and fixed in 5.15.168 with commit 72164d5b6489
	Issue introduced in 5.4 with commit bfde23ce200e and fixed in 6.1.113 with commit ab205e1c3846
	Issue introduced in 5.4 with commit bfde23ce200e and fixed in 6.6.54 with commit 1b8cf11b3ca5
	Issue introduced in 5.4 with commit bfde23ce200e and fixed in 6.10.13 with commit 9e279e6c1f01
	Issue introduced in 5.4 with commit bfde23ce200e and fixed in 6.11.2 with commit 1bd712de96ad
	Issue introduced in 5.4 with commit bfde23ce200e and fixed in 6.12-rc1 with commit 9a22b2812393

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-47739
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:
	kernel/padata.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/46c4079460f4dcaf445860679558eedef4e1bc91
	https://git.kernel.org/stable/c/72164d5b648951684b1a593996b37a6083c61d7d
	https://git.kernel.org/stable/c/ab205e1c3846326f162180e56825b4ba38ce9c30
	https://git.kernel.org/stable/c/1b8cf11b3ca593a8802a51802cd0c28c38501428
	https://git.kernel.org/stable/c/9e279e6c1f012b82628b89e1b9c65dbefa8ca25a
	https://git.kernel.org/stable/c/1bd712de96ad7167fe0d608e706cd60587579f16
	https://git.kernel.org/stable/c/9a22b2812393d93d84358a760c347c21939029a6