Subject: CVE-2024-46752: btrfs: replace BUG_ON() with error handling at update_ref_for_cow()

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

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

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

btrfs: replace BUG_ON() with error handling at update_ref_for_cow()

Instead of a BUG_ON() just return an error, log an error message and
abort the transaction in case we find an extent buffer belonging to the
relocation tree that doesn't have the full backref flag set. This is
unexpected and should never happen (save for bugs or a potential bad
memory).

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

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

	Fixed in 5.15.167 with commit b50857b96429
	Fixed in 6.1.110 with commit 0fbac73a9728
	Fixed in 6.6.51 with commit 41a0f85e268d
	Fixed in 6.10.10 with commit f895db00c65e
	Fixed in 6.11 with commit b56329a78231

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-46752
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/ctree.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/b50857b96429a09fd3beed9f7f21b7bb7c433688
	https://git.kernel.org/stable/c/0fbac73a97286a7ec72229cb9b42d760a2c717ac
	https://git.kernel.org/stable/c/41a0f85e268d72fe04f731b8ceea4748c2d65491
	https://git.kernel.org/stable/c/f895db00c65e5d77c437cce946da9ec29dcdf563
	https://git.kernel.org/stable/c/b56329a782314fde5b61058e2a25097af7ccb675