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

- Severity: High 7.8 (CVSS:3.1, scored by Linux) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.27%, higher than 20% of CVEs (2026-12-01)
- Published: 2025-06-18T11:00:55.352Z
- Modified: 2026-08-05T08:57:04.391Z
- Weaknesses: CWE-416
- Assigned by: Linux

## 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.

(As written by CVE List.)

## Affected

- Linux Linux: from 45a2966fd64147518dc5bca25f447bd0fb5359ac before f96b9f7c1676923bce871e728bb49c0dfa5013cc; from 45a2966fd64147518dc5bca25f447bd0fb5359ac before 9a6c710f3bc10bc9cc23e1c080b53245b7f9d5b7; from 45a2966fd64147518dc5bca25f447bd0fb5359ac before f87904c075515f3e1d8f4a7115869d3b914674fd; 5.15 (not affected: before 5.15; from 5.15.64 up to 5.15.*; from 5.19.6 up to 5.19.*; from 6.0 up to *)
- linux linux_kernel: from 5.15 before 5.15.64; from 5.16 before 5.19.6; 6.0

## Every score

- Linux: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://git.kernel.org/stable/c/f96b9f7c1676923bce871e728bb49c0dfa5013cc> (patch)
- <https://git.kernel.org/stable/c/9a6c710f3bc10bc9cc23e1c080b53245b7f9d5b7> (patch)
- <https://git.kernel.org/stable/c/f87904c075515f3e1d8f4a7115869d3b914674fd> (patch)

## Sources

- CVE List: [CVE-2022-49995](https://www.cve.org/CVERecord?id=CVE-2022-49995), CVE Terms of Use, modified 2026-08-05
- NVD: [CVE-2022-49995](https://nvd.nist.gov/vuln/detail/CVE-2022-49995), Public domain, modified 2026-08-04

---

Page: https://cve.day/CVE-2022-49995 · Whole record: https://cve.day/CVE-2022-49995.json · Rebuilt by cve.day 2026-11-25T22:58:20.999Z
