{"id":"CVE-2022-49995","state":"PUBLISHED","title":"writeback: avoid use-after-free after removing device","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nwriteback: avoid use-after-free after removing device\n\nWhen a disk is removed, bdi_unregister gets called to stop further\nwriteback and wait for associated delayed work to complete.  However,\nwb_inode_writeback_end() may schedule bandwidth estimation dwork after\nthis has completed, which can result in the timer attempting to access the\njust freed bdi_writeback.\n\nFix this by checking if the bdi_writeback is alive, similar to when\nscheduling writeback work.\n\nSince this requires wb->work_lock, and wb_inode_writeback_end() may get\ncalled from interrupt, switch wb->work_lock to an irqsafe lock.","publishedAt":"2025-06-18T11:00:55.352Z","updatedAt":"2026-08-05T08:57:04.391Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"45a2966fd64147518dc5bca25f447bd0fb5359ac","status":"affected","lessThan":"f96b9f7c1676923bce871e728bb49c0dfa5013cc","versionType":"git"},{"version":"45a2966fd64147518dc5bca25f447bd0fb5359ac","status":"affected","lessThan":"9a6c710f3bc10bc9cc23e1c080b53245b7f9d5b7","versionType":"git"},{"version":"45a2966fd64147518dc5bca25f447bd0fb5359ac","status":"affected","lessThan":"f87904c075515f3e1d8f4a7115869d3b914674fd","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/fs-writeback.c","mm/backing-dev.c","mm/page-writeback.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.15","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.15","versionType":"semver"},{"version":"5.15.64","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"5.19.6","status":"unaffected","lessThanOrEqual":"5.19.*","versionType":"semver"},{"version":"6.0","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/fs-writeback.c","mm/backing-dev.c","mm/page-writeback.c"]}],"references":["https://git.kernel.org/stable/c/f96b9f7c1676923bce871e728bb49c0dfa5013cc","https://git.kernel.org/stable/c/9a6c710f3bc10bc9cc23e1c080b53245b7f9d5b7","https://git.kernel.org/stable/c/f87904c075515f3e1d8f4a7115869d3b914674fd"],"weaknesses":[],"ingestedAt":"2026-10-29T20:05:26.763Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2022/49xxx/CVE-2022-49995.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2022-49995","state":"PUBLISHED","datePublished":"2025-06-18T11:00:55.352Z","dateUpdated":"2026-08-05T08:57:04.391Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-06-18T10:57:27.387Z"},"containers":{"cna":{"title":"writeback: avoid use-after-free after removing device","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nwriteback: avoid use-after-free after removing device\n\nWhen a disk is removed, bdi_unregister gets called to stop further\nwriteback and wait for associated delayed work to complete.  However,\nwb_inode_writeback_end() may schedule bandwidth estimation dwork after\nthis has completed, which can result in the timer attempting to access the\njust freed bdi_writeback.\n\nFix this by checking if the bdi_writeback is alive, similar to when\nscheduling writeback work.\n\nSince this requires wb->work_lock, and wb_inode_writeback_end() may get\ncalled from interrupt, switch wb->work_lock to an irqsafe lock."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"45a2966fd64147518dc5bca25f447bd0fb5359ac","status":"affected","lessThan":"f96b9f7c1676923bce871e728bb49c0dfa5013cc","versionType":"git"},{"version":"45a2966fd64147518dc5bca25f447bd0fb5359ac","status":"affected","lessThan":"9a6c710f3bc10bc9cc23e1c080b53245b7f9d5b7","versionType":"git"},{"version":"45a2966fd64147518dc5bca25f447bd0fb5359ac","status":"affected","lessThan":"f87904c075515f3e1d8f4a7115869d3b914674fd","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/fs-writeback.c","mm/backing-dev.c","mm/page-writeback.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.15","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.15","versionType":"semver"},{"version":"5.15.64","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"5.19.6","status":"unaffected","lessThanOrEqual":"5.19.*","versionType":"semver"},{"version":"6.0","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/fs-writeback.c","mm/backing-dev.c","mm/page-writeback.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/f96b9f7c1676923bce871e728bb49c0dfa5013cc"},{"url":"https://git.kernel.org/stable/c/9a6c710f3bc10bc9cc23e1c080b53245b7f9d5b7"},{"url":"https://git.kernel.org/stable/c/f87904c075515f3e1d8f4a7115869d3b914674fd"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The bug is reached via local filesystem writeback and block-device teardown (USB/removable media, del_gendisk → bdi_unregister), not by processing remote network packets. An attacker needs local access to dirty pages on an affected device.\nAC:L - The attacker can drive both sides of the race by generating writeback I/O and then removing or ejecting the device (e.g. udisks power-off or surprise unplug), and the delayed bw_dwork (~200ms) widens the window; this UAF was hit in practice (KASAN).\nPR:L - An unprivileged user can write to auto-mounted removable storage and trigger or cause its removal without CAP_SYS_ADMIN in the init namespace. Root-only sysfs delete is not required for the worst reasonable removable-media scenario.\nUI:N - The attacker can complete the full sequence (dirty data then eject/remove the device they wrote to) without relying on a separate victim action.\nS:U - This is a host-kernel use-after-free leading to privilege escalation within the same OS security authority, not a VM escape or IOMMU/cross-boundary breakout.\nC:H - Use-after-free of the bdi_writeback object lets an attacker reclaim and control freed kernel memory, enabling arbitrary kernel read primitives.\nI:H - The same UAF is exploitable via heap spray for arbitrary kernel writes and control-flow hijacking through the delayed bandwidth-update work path.\nA:H - The freed bdi_writeback is accessed from delayed work (observed as a KASAN splat), which can oops/panic the kernel even when not fully exploited."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T08:57:04.391Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"5.15.64"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"5.19.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.0"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}