{"id":"CVE-2026-143091","summary":"xen/privcmd: fix double free when an irqfd is shut down twice","details":"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-\u003ewqh, 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-\u003elist)\n  queue_work(&kirqfd-\u003eshutdown)        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.","modified":"2026-12-03T11:01:15.015627764Z","published":"2026-12-03T09:19:13.418Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143091.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/72a900c666adb97df77b05cf8540c4117f9c83ba"},{"type":"WEB","url":"https://git.kernel.org/stable/c/bec55c715b27e1eec4471968802c9d10ff6fef4e"},{"type":"WEB","url":"https://git.kernel.org/stable/c/c8dbf2b184aa82558fdcc1d58d4d2834b7743323"},{"type":"WEB","url":"https://git.kernel.org/stable/c/de87d311d5a3a5752949acb41962a86f31ce2ef0"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143091.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-143091"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"f8941e6c4c712948663ec5d7bbb546f1a0f4e3f6"},{"fixed":"c8dbf2b184aa82558fdcc1d58d4d2834b7743323"},{"fixed":"de87d311d5a3a5752949acb41962a86f31ce2ef0"},{"fixed":"bec55c715b27e1eec4471968802c9d10ff6fef4e"},{"fixed":"72a900c666adb97df77b05cf8540c4117f9c83ba"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143091.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.6.0"},{"fixed":"6.12.120"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.66"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.7"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143091.json"}}],"schema_version":"1.9.2"}