CVE-2022-49995 writeback: avoid use-after-free after removing device

High 7.8 Published Updated

A use-after-free in the Linux kernel writeback subsystem allows attackers to cause denial of service or execute code when a disk is removed.

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-49995?

CVE-2022-49995 is a high-severity use after free vulnerability in Linux kernel, published on 18 Jun 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:

writeback: avoid use-after-free after removing device

When a disk is removed, bdi_unregister gets called to stop further writeback and wait for associated delayed work to complete. However, wb_inode_writeback_end() may schedule bandwidth estimation dwork after this has completed, which can result in the timer attempting to access the just freed bdi_writeback.

Fix this by checking if the bdi_writeback is alive, similar to when scheduling writeback work.

Since this requires wb->work_lock, and wb_inode_writeback_end() may get called from interrupt, switch wb->work_lock to an irqsafe lock.

Weakness: CWE-416

Which versions are affected by CVE-2022-49995?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2022-49995?

Apply the vendor's patch.

Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.

Is CVE-2022-49995 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as DEBIAN-CVE-2022-49995, GHSA-cw67-vp4w-w46p, UBUNTU-CVE-2022-49995.

Is CVE-2022-49995 in your software?

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

Check your SBOMs for free