CVE-2024-46840 btrfs: clean up our handling of refs == 0 in snapshot delete

Medium 5.5 Published Updated

A flaw in the Linux kernel's btrfs filesystem could cause a system crash when handling zero references during snapshot deletion.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2024-46840?

CVE-2024-46840 is a medium-severity denial of service vulnerability in Linux kernel, published on 27 Sep 2024. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

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

btrfs: clean up our handling of refs == 0 in snapshot delete

In reada we BUG_ON(refs == 0), which could be unkind since we aren't holding a lock on the extent leaf and thus could get a transient incorrect answer. In walk_down_proc we also BUG_ON(refs == 0), which could happen if we have extent tree corruption. Change that to return -EUCLEAN. In do_walk_down() we catch this case and handle it correctly, however we return -EIO, which -EUCLEAN is a more appropriate error code. Finally in walk_up_proc we have the same BUG_ON(refs == 0), so convert that to proper error handling. Also adjust the error message so we can actually do something with the information.

Which versions are affected by CVE-2024-46840?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2024-46840?

Apply the vendor's patch.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2024-46840 being exploited?

There is no known exploitation of CVE-2024-46840 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as BELL-CVE-2024-46840, DEBIAN-CVE-2024-46840, GHSA-44xq-wgcc-3jwh, UBUNTU-CVE-2024-46840.

Is CVE-2024-46840 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free