CVE-2025-21786 workqueue: Put the pwq after detaching the rescuer from the pool

High 7.8 Published Updated

A use-after-free vulnerability in the Linux kernel workqueue subsystem allows attackers to execute arbitrary 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-2025-21786?

CVE-2025-21786 is a high-severity use after free vulnerability in Linux kernel, published on 27 Feb 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:

workqueue: Put the pwq after detaching the rescuer from the pool

The commit 68f83057b913("workqueue: Reap workers via kthread_stop() and remove detach_completion") adds code to reap the normal workers but mistakenly does not handle the rescuer and also removes the code waiting for the rescuer in put_unbound_pool(), which caused a use-after-free bug reported by Cheung Wall.

To avoid the use-after-free bug, the pool’s reference must be held until the detachment is complete. Therefore, move the code that puts the pwq after detaching the rescuer from the pool.

Weakness: CWE-416

Which versions are affected by CVE-2025-21786?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2025-21786?

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-2025-21786 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as AZL-58887, AZL-58922, BELL-CVE-2025-21786, DEBIAN-CVE-2025-21786, GHSA-jfr9-726h-gv8r, ROOT-OS-UBUNTU-2204-CVE-2025-21786 and 2 more.

Is CVE-2025-21786 in your software?

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

Check your SBOMs for free