Subject: CVE-2024-35820: io_uring: fix io_queue_proc modifying req->flags

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

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

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

io_uring: fix io_queue_proc modifying req->flags

With multiple poll entries __io_queue_proc() might be running in
parallel with poll handlers and possibly task_work, we should not be
carelessly modifying req->flags there. io_poll_double_prepare() handles
a similar case with locking but it's much easier to move it into
__io_arm_poll_handler().

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

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

	Issue introduced in 6.7 with commit 595e52284d24 and fixed in 6.7.12 with commit 51a490a7f63c
	Issue introduced in 6.7 with commit 595e52284d24 and fixed in 6.8.3 with commit 0ecb8919469e
	Issue introduced in 6.7 with commit 595e52284d24 and fixed in 6.9 with commit 1a8ec63b2b6c

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-35820
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:
	io_uring/poll.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/51a490a7f63cae0754120e7c04f4f47920bd48db
	https://git.kernel.org/stable/c/0ecb8919469e6d5c74eea24086b34ce1bda5aef7
	https://git.kernel.org/stable/c/1a8ec63b2b6c91caec87d4e132b1f71b5df342be