CVE-2022-50379 btrfs: fix race between quota enable and quota rescan ioctl

Medium 4.7 Published Updated

A race condition in the Linux kernel btrfs filesystem can lead to a use-after-free, potentially allowing local attackers to execute code or escalate privileges.

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-2022-50379?

CVE-2022-50379 is a medium-severity vulnerability in Linux kernel, published on 18 Sep 2025. 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: fix race between quota enable and quota rescan ioctl

When enabling quotas, at btrfs_quota_enable(), after committing the transaction, we change fs_info->quota_root to point to the quota root we created and set BTRFS_FS_QUOTA_ENABLED at fs_info->flags. Then we try to start the qgroup rescan worker, first by initializing it with a call to qgroup_rescan_init() - however if that fails we end up freeing the quota root but we leave fs_info->quota_root still pointing to it, this can later result in a use-after-free somewhere else.

We have previously set the flags BTRFS_FS_QUOTA_ENABLED and BTRFS_QGROUP_STATUS_FLAG_ON, so we can only fail with -EINPROGRESS at btrfs_quota_enable(), which is possible if someone already called the quota rescan ioctl, and therefore started the rescan worker.

So fix this by ignoring an -EINPROGRESS and asserting we can't get any other error.

Weakness: CWE-362

Which versions are affected by CVE-2022-50379?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2022-50379?

Apply the vendor's patch.

Is CVE-2022-50379 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as DEBIAN-CVE-2022-50379, GHSA-ffg2-pg2r-fw6w, UBUNTU-CVE-2022-50379.

Is CVE-2022-50379 in your software?

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

Check your SBOMs for free