CVE-2025-21786
Published: 27 February 2025
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.
Security Summary
CVE-2025-21786 is a use-after-free vulnerability (CWE-416) in the Linux kernel's workqueue subsystem. The issue arises from commit 68f83057b913 ("workqueue: Reap workers via kthread_stop() and remove detach_completion"), which added code to reap normal workers but incorrectly omitted handling for the rescuer worker and removed the wait for it in put_unbound_pool(). This results in the pool's reference not being held until rescuer detachment completes, triggering the use-after-free as reported by Cheung Wall.
The vulnerability has a CVSS 3.1 base score of 7.8 (AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H), indicating it can be exploited by a local attacker with low privileges and no user interaction. Successful exploitation could allow the attacker to achieve high impacts on confidentiality, integrity, and availability, such as arbitrary kernel code execution or system denial of service.
Mitigation requires applying upstream stable kernel patches, including those in commits 835b69c868f53f959d4986bbecd561ba6f38e492, e76946110137703c16423baf6ee177b751a34b7e, and e7c16028a424dd35be1064a68fa318be4359310f. These patches resolve the issue by moving the pwq put operation after fully detaching the rescuer from the pool.
Details
- CWE(s)