{"id":"CVE-2026-143091","state":"PUBLISHED","title":"xen/privcmd: fix double free when an irqfd is shut down twice","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nxen/privcmd: fix double free when an irqfd is shut down twice\n\nirqfd_deactivate() takes the irqfd off irqfds_list and queues\nirqfd_shutdown().  queue_work() is not a once-only gate: it refuses to\nenqueue a work item only while WORK_STRUCT_PENDING is set, and\nprocess_one_work() clears that bit before it calls the work function.  So\nnothing records that the shutdown work has already been queued, and\nnothing protects the window between the start of irqfd_shutdown() and the\nkfree() at its end.\n\nTwo paths call irqfd_deactivate() for the same irqfd:\n\n  - privcmd_irqfd_deassign(), from the PRIVCMD_IRQFD_FLAG_DEASSIGN ioctl;\n\n  - irqfd_wakeup(), with EPOLLHUP set, when the last reference to the\n    eventfd file goes away, which runs wake_up_poll(&ctx->wqh, EPOLLHUP)\n    from eventfd_release().\n\nirqfds_lock serialises the two calls, but it does not make the second one\na no-op, and eventfd_ctx_fdget() takes a reference to the eventfd_ctx,\nnot to the struct file, so the last fd can still be closed while the\nioctl is running:\n\n  CPU0                                 CPU1\n\n  eventfd_ctx_fdget()\n  spin_lock(irqfds_lock)\n  list_del_init(&kirqfd->list)\n  queue_work(&kirqfd->shutdown)        close(fd)\n                                         eventfd_release()\n                                           wake_up_poll(EPOLLHUP)\n                                         irqfd_wakeup()\n                                         spin_lock(irqfds_lock)\n                                         irqfd_deactivate() again\n\nIf the work item has already started by then, its pending bit has been\ncleared and the second queue_work() succeeds.  irqfd_shutdown() then runs\ntwice, so eventfd_ctx_remove_wait_queue(), eventfd_ctx_put() and kfree()\neach hit the same object a second time; and when the second queue_work()\nlands after the irqfd has been freed, the workqueue list operations write\nto freed memory.\n\nvirt/kvm/eventfd.c has the same two callers and has had this guard since\nthe original irqfd support (721eecbf4fe99): irqfd_wakeup() calls\nirqfd_deactivate() only if irqfd_is_active().  The comment there explains\nwhy that is enough: the other side deactivates the irqfd before it takes\nit off the waitqueue, and irqfd_shutdown() needs the waitqueue lock,\nwhich this callback holds, so the irqfd cannot be freed under it.\n\nDo the same here.  list_del_init() leaves the list head empty and the\nirqfd stays off the list until kfree(), so it serves as a one-way\n\"active\" flag.  The test is in irqfd_deactivate() rather than in\nirqfd_wakeup() because privcmd_irqfd_deassign() walks irqfds_list and can\ntherefore never reach an inactive irqfd; only the wakeup path can, and a\nsingle test covers both callers.","publishedAt":"2026-12-03T09:19:13.418Z","updatedAt":"2026-12-03T09:19:13.418Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"f8941e6c4c712948663ec5d7bbb546f1a0f4e3f6","status":"affected","lessThan":"c8dbf2b184aa82558fdcc1d58d4d2834b7743323","versionType":"git"},{"version":"f8941e6c4c712948663ec5d7bbb546f1a0f4e3f6","status":"affected","lessThan":"de87d311d5a3a5752949acb41962a86f31ce2ef0","versionType":"git"},{"version":"f8941e6c4c712948663ec5d7bbb546f1a0f4e3f6","status":"affected","lessThan":"bec55c715b27e1eec4471968802c9d10ff6fef4e","versionType":"git"},{"version":"f8941e6c4c712948663ec5d7bbb546f1a0f4e3f6","status":"affected","lessThan":"72a900c666adb97df77b05cf8540c4117f9c83ba","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/xen/privcmd.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.6","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.6","versionType":"semver"},{"version":"6.12.120","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.66","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.7","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/xen/privcmd.c"]}],"references":["https://git.kernel.org/stable/c/c8dbf2b184aa82558fdcc1d58d4d2834b7743323","https://git.kernel.org/stable/c/de87d311d5a3a5752949acb41962a86f31ce2ef0","https://git.kernel.org/stable/c/bec55c715b27e1eec4471968802c9d10ff6fef4e","https://git.kernel.org/stable/c/72a900c666adb97df77b05cf8540c4117f9c83ba"],"weaknesses":[],"ingestedAt":"2026-12-03T09:28:04.553Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/143xxx/CVE-2026-143091.json","commit":"9fd484e43f2e14021809e195d28c1172759faad0","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-143091","state":"PUBLISHED","datePublished":"2026-12-03T09:19:13.418Z","dateUpdated":"2026-12-03T09:19:13.418Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-12-03T03:10:28.347Z"},"containers":{"cna":{"title":"xen/privcmd: fix double free when an irqfd is shut down twice","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nxen/privcmd: fix double free when an irqfd is shut down twice\n\nirqfd_deactivate() takes the irqfd off irqfds_list and queues\nirqfd_shutdown().  queue_work() is not a once-only gate: it refuses to\nenqueue a work item only while WORK_STRUCT_PENDING is set, and\nprocess_one_work() clears that bit before it calls the work function.  So\nnothing records that the shutdown work has already been queued, and\nnothing protects the window between the start of irqfd_shutdown() and the\nkfree() at its end.\n\nTwo paths call irqfd_deactivate() for the same irqfd:\n\n  - privcmd_irqfd_deassign(), from the PRIVCMD_IRQFD_FLAG_DEASSIGN ioctl;\n\n  - irqfd_wakeup(), with EPOLLHUP set, when the last reference to the\n    eventfd file goes away, which runs wake_up_poll(&ctx->wqh, EPOLLHUP)\n    from eventfd_release().\n\nirqfds_lock serialises the two calls, but it does not make the second one\na no-op, and eventfd_ctx_fdget() takes a reference to the eventfd_ctx,\nnot to the struct file, so the last fd can still be closed while the\nioctl is running:\n\n  CPU0                                 CPU1\n\n  eventfd_ctx_fdget()\n  spin_lock(irqfds_lock)\n  list_del_init(&kirqfd->list)\n  queue_work(&kirqfd->shutdown)        close(fd)\n                                         eventfd_release()\n                                           wake_up_poll(EPOLLHUP)\n                                         irqfd_wakeup()\n                                         spin_lock(irqfds_lock)\n                                         irqfd_deactivate() again\n\nIf the work item has already started by then, its pending bit has been\ncleared and the second queue_work() succeeds.  irqfd_shutdown() then runs\ntwice, so eventfd_ctx_remove_wait_queue(), eventfd_ctx_put() and kfree()\neach hit the same object a second time; and when the second queue_work()\nlands after the irqfd has been freed, the workqueue list operations write\nto freed memory.\n\nvirt/kvm/eventfd.c has the same two callers and has had this guard since\nthe original irqfd support (721eecbf4fe99): irqfd_wakeup() calls\nirqfd_deactivate() only if irqfd_is_active().  The comment there explains\nwhy that is enough: the other side deactivates the irqfd before it takes\nit off the waitqueue, and irqfd_shutdown() needs the waitqueue lock,\nwhich this callback holds, so the irqfd cannot be freed under it.\n\nDo the same here.  list_del_init() leaves the list head empty and the\nirqfd stays off the list until kfree(), so it serves as a one-way\n\"active\" flag.  The test is in irqfd_deactivate() rather than in\nirqfd_wakeup() because privcmd_irqfd_deassign() walks irqfds_list and can\ntherefore never reach an inactive irqfd; only the wakeup path can, and a\nsingle test covers both callers."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"f8941e6c4c712948663ec5d7bbb546f1a0f4e3f6","status":"affected","lessThan":"c8dbf2b184aa82558fdcc1d58d4d2834b7743323","versionType":"git"},{"version":"f8941e6c4c712948663ec5d7bbb546f1a0f4e3f6","status":"affected","lessThan":"de87d311d5a3a5752949acb41962a86f31ce2ef0","versionType":"git"},{"version":"f8941e6c4c712948663ec5d7bbb546f1a0f4e3f6","status":"affected","lessThan":"bec55c715b27e1eec4471968802c9d10ff6fef4e","versionType":"git"},{"version":"f8941e6c4c712948663ec5d7bbb546f1a0f4e3f6","status":"affected","lessThan":"72a900c666adb97df77b05cf8540c4117f9c83ba","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/xen/privcmd.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.6","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.6","versionType":"semver"},{"version":"6.12.120","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.66","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.7","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/xen/privcmd.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/c8dbf2b184aa82558fdcc1d58d4d2834b7743323"},{"url":"https://git.kernel.org/stable/c/de87d311d5a3a5752949acb41962a86f31ce2ef0"},{"url":"https://git.kernel.org/stable/c/bec55c715b27e1eec4471968802c9d10ff6fef4e"},{"url":"https://git.kernel.org/stable/c/72a900c666adb97df77b05cf8540c4117f9c83ba"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-12-03T09:19:13.418Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"6.12.120"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"6.18.66"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"7.3.7"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"7.4-rc3"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}