Subject: CVE-2024-35793: debugfs: fix wait/cancellation handling during remove

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

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

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

debugfs: fix wait/cancellation handling during remove

Ben Greear further reports deadlocks during concurrent debugfs
remove while files are being accessed, even though the code in
question now uses debugfs cancellations. Turns out that despite
all the review on the locking, we missed completely that the
logic is wrong: if the refcount hits zero we can finish (and
need not wait for the completion), but if it doesn't we have
to trigger all the cancellations. As written, we can _never_
get into the loop triggering the cancellations. Fix this, and
explain it better while at it.

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

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

	Issue introduced in 6.7 with commit 8c88a474357e and fixed in 6.7.12 with commit e88b5ae01901
	Issue introduced in 6.7 with commit 8c88a474357e and fixed in 6.8.3 with commit 3d08cca5fd0a
	Issue introduced in 6.7 with commit 8c88a474357e and fixed in 6.9 with commit 952c3fce297f

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-35793
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:
	fs/debugfs/inode.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/e88b5ae01901c4a655a53158397746334778a57b
	https://git.kernel.org/stable/c/3d08cca5fd0aabb62b7015067ab40913b33da906
	https://git.kernel.org/stable/c/952c3fce297f12c7ff59380adb66b564e2bc9b64