Subject: CVE-2024-35935: btrfs: send: handle path ref underflow in header iterate_inode_ref()

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

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

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

btrfs: send: handle path ref underflow in header iterate_inode_ref()

Change BUG_ON to proper error handling if building the path buffer
fails. The pointers are not printed so we don't accidentally leak kernel
addresses.

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

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

	Fixed in 4.19.312 with commit be2b6bcc936a
	Fixed in 5.4.274 with commit 024529c27c8b
	Fixed in 5.10.215 with commit 4720d590c4cb
	Fixed in 5.15.155 with commit 2f6174fd4ccf
	Fixed in 6.1.86 with commit 9ae356c627b4
	Fixed in 6.6.27 with commit c1363ed8867b
	Fixed in 6.8.6 with commit 03938619a1e7
	Fixed in 6.9 with commit 3c6ee34c6f9c

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-35935
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/btrfs/send.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/be2b6bcc936ae17f42fff6494106a5660b35d8d3
	https://git.kernel.org/stable/c/024529c27c8b4b273325a169e078337c8279e229
	https://git.kernel.org/stable/c/4720d590c4cb5d9ffa0060b89743651cc7e995f9
	https://git.kernel.org/stable/c/2f6174fd4ccf403b42b3d5f0d1b6b496a0e5330a
	https://git.kernel.org/stable/c/9ae356c627b493323e1433dcb27a26917668c07c
	https://git.kernel.org/stable/c/c1363ed8867b81ea169fba2ccc14af96a85ed183
	https://git.kernel.org/stable/c/03938619a1e718b6168ae4528e1b0f979293f1a5
	https://git.kernel.org/stable/c/3c6ee34c6f9cd12802326da26631232a61743501