{"id":"CVE-2026-139075","state":"PUBLISHED","title":"drm/nouveau: disable the fence uevent work instead of just cancelling it","description":"In the Linux kernel, the following vulnerability has been resolved:\n\ndrm/nouveau: disable the fence uevent work instead of just cancelling it\n\nnouveau_fence_context_del() drains the uevent work while the event that\nfeeds it is still armed:\n\n\tcancel_work_sync(&fctx->uevent_work);\n\tnouveau_fence_context_kill(fctx, 0);\n\tnvif_event_dtor(&fctx->event);\n\nnouveau_fence_wait_uevent_handler() queues the work unconditionally:\n\n\tschedule_work(&fctx->uevent_work);\n\treturn NVIF_EVENT_KEEP;\n\nso a non-stall interrupt arriving after cancel_work_sync() has returned\nre-arms the work that was just drained.  The window closes in two steps,\nneither of which is the drain.  The kill blocks the event when the last\nfence holding a notify_ref is signalled, which reaches\natomic_xchg(&ntfy->allowed, 0) (nvkm/core/event.c:104), and\nnvkm_event_ntfy() skips a ntfy that is not allowed (:183).  That stops\nfurther handlers from starting, but not one that is already inside\nnvkm_event_ntfy(): the event is created with wait = false\n(nouveau_fence.c:201), so nvkm_event_ntfy_block_() leaves it on the list\nand never takes event->list_lock.  Only nvif_event_dtor() waits that one\nout: nvkm_event_ntfy_del() (:141) goes through nvkm_event_ntfy_remove(),\nwhich takes write_lock_irq() on that same list_lock (:84).\n\nEither way the re-arm happens after the drain, and the caller drops its\nreference immediately afterwards, for example nv84_fence_context_del():\n\n\tnouveau_fence_context_del(&fctx->base);\n\tchan->fence = NULL;\n\tnouveau_fence_context_free(&fctx->base);\n\nThat is a kref_put() on fctx->fence_ref, so the context outlives the\nteardown only while emitted fences still hold a reference of their own.\nThat is no safety net: whenever none do, the count reaches zero right\nthere and nouveau_fence_context_put() kfree()s fctx while the work is\nstill queued.  &fctx->uevent_work is embedded in that allocation, so the\nworkqueue already dereferences freed memory when it picks the item up,\nand nouveau_fence_uevent_work() can then take fctx->lock on it.  With\nCONFIG_DEBUG_OBJECTS_WORK and CONFIG_DEBUG_OBJECTS_FREE, kfree() of a\nstill-queued work item is reported as the free of an active object.\n\nOn live memory the re-armed work has nothing left to do:\nnouveau_fence_context_kill() empties fctx->pending and sets fctx->killed\nunder fctx->lock, nouveau_fence_emit() then returns -ENODEV rather than\nqueueing anything new, and nouveau_fence_update() only reaches\nnvif_event_block() if it signalled something off that list.  The defect\nis the access to freed memory, not what the work would have found.\n\nOnly chips from G84 on can reach this at all: nouveau_fence_context_new()\nreturns before nvif_event_ctor() when priv->uevent is clear, and\nnv84_fence_create() is the only place that sets it.\nnv84_fence_context_del() is the context_del for all of those, because\nnvc0_fence_create() and gv100_fence_create() build on nv84_fence_create()\nand override only context_new.\n\nUse disable_work_sync() instead.  It drains the work exactly like\ncancel_work_sync() does, and additionally increments the work item's\ndisable count, after which \"any attempt to queue @work will fail and\nreturn %false\" (kernel/workqueue.c, disable_work()).  The handler's\nschedule_work() then has nothing to re-arm, and the teardown order stays\nas it is.\n\nDraining a second time after nvif_event_dtor() would close the window as\nwell, and without the newer API: once nvkm_event_ntfy_remove() has\nreturned, no handler can start or still be running, so nothing re-arms\nthe work past that point.  disable_work_sync() is preferred here because\nit needs one synchronisation point instead of two, it keeps the work\nfrom being queued at all rather than cleaning up after it, and it is\nwhat drm has settled on for this (drm/xe, drm/panthor, drm_pagemap).\nBlocking the event rather than the work is not an option: fctx->event is\ncreated with wait = false, so a handler already inside nvkm_event_ntfy()\ncan still queue the work.\n\nNote for backpor\n---truncated---","publishedAt":"2026-11-30T13:27:39.940Z","updatedAt":"2026-11-30T13:27:39.940Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"cc0037fa592d56e4abb9c7d1c52c4d2dc25cd906","status":"affected","lessThan":"fba3e939ed5cb2f1cd255a6bc5b9c1fb921d8587","versionType":"git"},{"version":"39126abc5e20611579602f03b66627d7cd1422f0","status":"affected","lessThan":"d45c83c41b2d7cf25dbd9ba44a35ee66aaa23c67","versionType":"git"},{"version":"39126abc5e20611579602f03b66627d7cd1422f0","status":"affected","lessThan":"f688ffe4a23ae12d2947e68b10225b208c36022c","versionType":"git"},{"version":"39126abc5e20611579602f03b66627d7cd1422f0","status":"affected","lessThan":"bf09cf3e05011b77d00c7dd4abca760dd8fff4f4","versionType":"git"},{"version":"39126abc5e20611579602f03b66627d7cd1422f0","status":"affected","lessThan":"827eb9328eaed831d7cc426ac2705038a40835b6","versionType":"git"},{"version":"985d053f7633d8b539ab1531738d538efac678a9","status":"affected","versionType":"git"},{"version":"6.6.18","status":"affected","lessThan":"6.6.163","versionType":"semver"},{"version":"6.7.6","status":"affected","lessThan":"6.8","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/gpu/drm/nouveau/nouveau_fence.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.8","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.63","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.4","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/gpu/drm/nouveau/nouveau_fence.c"]}],"references":["https://git.kernel.org/stable/c/fba3e939ed5cb2f1cd255a6bc5b9c1fb921d8587","https://git.kernel.org/stable/c/d45c83c41b2d7cf25dbd9ba44a35ee66aaa23c67","https://git.kernel.org/stable/c/f688ffe4a23ae12d2947e68b10225b208c36022c","https://git.kernel.org/stable/c/bf09cf3e05011b77d00c7dd4abca760dd8fff4f4","https://git.kernel.org/stable/c/827eb9328eaed831d7cc426ac2705038a40835b6"],"weaknesses":[],"ingestedAt":"2026-11-30T13:42:04.437Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139075.json","commit":"5317bbbde1916a58cb1fadabb726eb126daf44c1","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139075","state":"PUBLISHED","datePublished":"2026-11-30T13:27:39.940Z","dateUpdated":"2026-11-30T13:27:39.940Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.912Z"},"containers":{"cna":{"title":"drm/nouveau: disable the fence uevent work instead of just cancelling it","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\ndrm/nouveau: disable the fence uevent work instead of just cancelling it\n\nnouveau_fence_context_del() drains the uevent work while the event that\nfeeds it is still armed:\n\n\tcancel_work_sync(&fctx->uevent_work);\n\tnouveau_fence_context_kill(fctx, 0);\n\tnvif_event_dtor(&fctx->event);\n\nnouveau_fence_wait_uevent_handler() queues the work unconditionally:\n\n\tschedule_work(&fctx->uevent_work);\n\treturn NVIF_EVENT_KEEP;\n\nso a non-stall interrupt arriving after cancel_work_sync() has returned\nre-arms the work that was just drained.  The window closes in two steps,\nneither of which is the drain.  The kill blocks the event when the last\nfence holding a notify_ref is signalled, which reaches\natomic_xchg(&ntfy->allowed, 0) (nvkm/core/event.c:104), and\nnvkm_event_ntfy() skips a ntfy that is not allowed (:183).  That stops\nfurther handlers from starting, but not one that is already inside\nnvkm_event_ntfy(): the event is created with wait = false\n(nouveau_fence.c:201), so nvkm_event_ntfy_block_() leaves it on the list\nand never takes event->list_lock.  Only nvif_event_dtor() waits that one\nout: nvkm_event_ntfy_del() (:141) goes through nvkm_event_ntfy_remove(),\nwhich takes write_lock_irq() on that same list_lock (:84).\n\nEither way the re-arm happens after the drain, and the caller drops its\nreference immediately afterwards, for example nv84_fence_context_del():\n\n\tnouveau_fence_context_del(&fctx->base);\n\tchan->fence = NULL;\n\tnouveau_fence_context_free(&fctx->base);\n\nThat is a kref_put() on fctx->fence_ref, so the context outlives the\nteardown only while emitted fences still hold a reference of their own.\nThat is no safety net: whenever none do, the count reaches zero right\nthere and nouveau_fence_context_put() kfree()s fctx while the work is\nstill queued.  &fctx->uevent_work is embedded in that allocation, so the\nworkqueue already dereferences freed memory when it picks the item up,\nand nouveau_fence_uevent_work() can then take fctx->lock on it.  With\nCONFIG_DEBUG_OBJECTS_WORK and CONFIG_DEBUG_OBJECTS_FREE, kfree() of a\nstill-queued work item is reported as the free of an active object.\n\nOn live memory the re-armed work has nothing left to do:\nnouveau_fence_context_kill() empties fctx->pending and sets fctx->killed\nunder fctx->lock, nouveau_fence_emit() then returns -ENODEV rather than\nqueueing anything new, and nouveau_fence_update() only reaches\nnvif_event_block() if it signalled something off that list.  The defect\nis the access to freed memory, not what the work would have found.\n\nOnly chips from G84 on can reach this at all: nouveau_fence_context_new()\nreturns before nvif_event_ctor() when priv->uevent is clear, and\nnv84_fence_create() is the only place that sets it.\nnv84_fence_context_del() is the context_del for all of those, because\nnvc0_fence_create() and gv100_fence_create() build on nv84_fence_create()\nand override only context_new.\n\nUse disable_work_sync() instead.  It drains the work exactly like\ncancel_work_sync() does, and additionally increments the work item's\ndisable count, after which \"any attempt to queue @work will fail and\nreturn %false\" (kernel/workqueue.c, disable_work()).  The handler's\nschedule_work() then has nothing to re-arm, and the teardown order stays\nas it is.\n\nDraining a second time after nvif_event_dtor() would close the window as\nwell, and without the newer API: once nvkm_event_ntfy_remove() has\nreturned, no handler can start or still be running, so nothing re-arms\nthe work past that point.  disable_work_sync() is preferred here because\nit needs one synchronisation point instead of two, it keeps the work\nfrom being queued at all rather than cleaning up after it, and it is\nwhat drm has settled on for this (drm/xe, drm/panthor, drm_pagemap).\nBlocking the event rather than the work is not an option: fctx->event is\ncreated with wait = false, so a handler already inside nvkm_event_ntfy()\ncan still queue the work.\n\nNote for backpor\n---truncated---"}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"cc0037fa592d56e4abb9c7d1c52c4d2dc25cd906","status":"affected","lessThan":"fba3e939ed5cb2f1cd255a6bc5b9c1fb921d8587","versionType":"git"},{"version":"39126abc5e20611579602f03b66627d7cd1422f0","status":"affected","lessThan":"d45c83c41b2d7cf25dbd9ba44a35ee66aaa23c67","versionType":"git"},{"version":"39126abc5e20611579602f03b66627d7cd1422f0","status":"affected","lessThan":"f688ffe4a23ae12d2947e68b10225b208c36022c","versionType":"git"},{"version":"39126abc5e20611579602f03b66627d7cd1422f0","status":"affected","lessThan":"bf09cf3e05011b77d00c7dd4abca760dd8fff4f4","versionType":"git"},{"version":"39126abc5e20611579602f03b66627d7cd1422f0","status":"affected","lessThan":"827eb9328eaed831d7cc426ac2705038a40835b6","versionType":"git"},{"version":"985d053f7633d8b539ab1531738d538efac678a9","status":"affected","versionType":"git"},{"version":"6.6.18","status":"affected","lessThan":"6.6.163","versionType":"semver"},{"version":"6.7.6","status":"affected","lessThan":"6.8","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/gpu/drm/nouveau/nouveau_fence.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.8","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.63","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.4","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/gpu/drm/nouveau/nouveau_fence.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/fba3e939ed5cb2f1cd255a6bc5b9c1fb921d8587"},{"url":"https://git.kernel.org/stable/c/d45c83c41b2d7cf25dbd9ba44a35ee66aaa23c67"},{"url":"https://git.kernel.org/stable/c/f688ffe4a23ae12d2947e68b10225b208c36022c"},{"url":"https://git.kernel.org/stable/c/bf09cf3e05011b77d00c7dd4abca760dd8fff4f4"},{"url":"https://git.kernel.org/stable/c/827eb9328eaed831d7cc426ac2705038a40835b6"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:27:39.940Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6.18","versionEndExcluding":"6.6.163"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.12.117"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.18.63"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"7.3.4"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"7.4-rc1"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.7.6"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}