{"id":"CVE-2026-139582","state":"PUBLISHED","title":"RDMA/nldev: Fix NULL deref in dumps of objects abandoned by DRIVER_FAILURE","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nRDMA/nldev: Fix NULL deref in dumps of objects abandoned by DRIVER_FAILURE\n\nfill_res_cq_entry() dereferences cq->uobject->uevent.uobject.context->res.id\nunconditionally for user resources.\n\nThis is normally safe by ordering: destroy_hw() removes the resource\nfrom the restrack before uverbs_destroy_uobject() clears ->context,\nand the XA_ZERO_ENTRY marker set by rdma_restrack_begin_del() hides\nthe entry from concurrent netlink dumps.\n\nThe ordering breaks when a driver keeps failing to destroy an object\nduring ucontext teardown. uverbs_destroy_ufile_hw() then falls back to\n__uverbs_cleanup_ufile(RDMA_REMOVE_DRIVER_FAILURE), which\nabandons the object in place: the HW object and its restrack entry\nare intentionally leaked, while the uobject bookkeeping is torn down\nand ->context is explicitly set to NULL by uverbs_destroy_uobject().\nrdma_restrack_del() is never reached, so the orphaned entry stays in\nthe device restrack with a valid kref, reachable by any subsequent\nnetlink dump.\n\nObserved on 6.1.52 with MLNX_OFED 24.10, after an mlx5 FW failure\nleft a process unable to tear down its CQ (destroy_cq FW command\nfailing during FD close):\n\n  WARNING: ... uverbs_destroy_ufile_hw+0xe3/0x100\n  BUG: kernel NULL pointer dereference, address: 0000000000000058\n  RIP: 0010:fill_res_cq_entry+0x15e/0x180 [ib_core]\n   res_get_common_dumpit+0x304/0x530 [ib_core]\n   nldev_res_get_cq_dumpit+0x1a/0x20 [ib_core]\n\nThe faulting chain maps to the source (CR2 = 0x58):\n  cq->uobject            (struct ib_cq +0x08, res at +0x98)\n  uobject->context       (struct ib_uobject +0x10, NULL after abandon)\n  context->res.id        (struct ib_ucontext +0x58)\n\nThe recent restrack rework (8d186210677c and its series) moved the\nrestrack deletion to the start of the destroy flow and thus fences\nconcurrent dumps from an object being destroyed, but it does not\ncover this case: when destroy fails, rdma_restrack_abort_del()\nrestores the entry, and the RDMA_REMOVE_DRIVER_FAILURE sweep still\nnever removes it from the restrack.\n\nFrom the fallback until the device is unregistered, any \"rdma res\nshow cq\" deterministically takes the NULL pointer dereference; this\nis a long-lived state, NOT A RACE. The dump path holds neither the\nrestrack lock (dropped before the fill callback runs) nor\nufile->hw_destroy_rwsem, and rdma_restrack_get() only guarantees\nthat the res memory stays alive, not that ->context is still valid.\n\nFix the dump side: check the uobject context directly instead of the\nrdma_is_kernel_res() marker. A non-NULL uobject already implies a\nuser resource, so kernel resources keep being skipped, and the\nadditional ->context check skips the RES_CTXN attribute for\norphaned entries instead of crashing the dump. The orphaned resource\nitself remains visible in \"rdma res show\" (cqn/cqe/usecnt/pid),\nwhich is what an operator needs after the accompanying uverbs WARN\nto diagnose the driver destroy failure.\n\nfill_res_pd_entry() has the same pattern (pd->uobject->context->res.id)\nand is fixed the same way; a PD can even reach the fallback without\nits own driver callback failing, e.g. uverbs_free_pd() returns -EBUSY\nwhile another object that failed to destroy still holds the PD usecnt.","publishedAt":"2026-11-30T13:36:05.338Z","updatedAt":"2026-11-30T13:36:05.338Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"9715d98286d4660e0ebdeae13da4f78d57b246c0","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"f1681bc5ee4c9234c5f841b40a454abfc657bdc3","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"8f3709434f0ed0f349e86e1a5bce752151745987","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"abfde1965a611f6854be3d5110cf74ee6b5ade7a","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"da6bda5d4a15ddfe4489c81469f377437ca2c00b","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"98db004ba2271e9709e39c069df8912b7ae85dfa","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"8897a629706ff34f261fdb87e093c8ae174436d0","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"9f4c322be27bf617cad2f4a15f6c6024a69e220c","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/infiniband/core/nldev.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.1","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.1","versionType":"semver"},{"version":"5.10.275","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","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/infiniband/core/nldev.c"]}],"references":["https://git.kernel.org/stable/c/9715d98286d4660e0ebdeae13da4f78d57b246c0","https://git.kernel.org/stable/c/f1681bc5ee4c9234c5f841b40a454abfc657bdc3","https://git.kernel.org/stable/c/8f3709434f0ed0f349e86e1a5bce752151745987","https://git.kernel.org/stable/c/abfde1965a611f6854be3d5110cf74ee6b5ade7a","https://git.kernel.org/stable/c/da6bda5d4a15ddfe4489c81469f377437ca2c00b","https://git.kernel.org/stable/c/98db004ba2271e9709e39c069df8912b7ae85dfa","https://git.kernel.org/stable/c/8897a629706ff34f261fdb87e093c8ae174436d0","https://git.kernel.org/stable/c/9f4c322be27bf617cad2f4a15f6c6024a69e220c"],"weaknesses":[],"ingestedAt":"2026-11-30T13:52:04.503Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139582.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139582","state":"PUBLISHED","datePublished":"2026-11-30T13:36:05.338Z","dateUpdated":"2026-11-30T13:36:05.338Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.941Z"},"containers":{"cna":{"title":"RDMA/nldev: Fix NULL deref in dumps of objects abandoned by DRIVER_FAILURE","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nRDMA/nldev: Fix NULL deref in dumps of objects abandoned by DRIVER_FAILURE\n\nfill_res_cq_entry() dereferences cq->uobject->uevent.uobject.context->res.id\nunconditionally for user resources.\n\nThis is normally safe by ordering: destroy_hw() removes the resource\nfrom the restrack before uverbs_destroy_uobject() clears ->context,\nand the XA_ZERO_ENTRY marker set by rdma_restrack_begin_del() hides\nthe entry from concurrent netlink dumps.\n\nThe ordering breaks when a driver keeps failing to destroy an object\nduring ucontext teardown. uverbs_destroy_ufile_hw() then falls back to\n__uverbs_cleanup_ufile(RDMA_REMOVE_DRIVER_FAILURE), which\nabandons the object in place: the HW object and its restrack entry\nare intentionally leaked, while the uobject bookkeeping is torn down\nand ->context is explicitly set to NULL by uverbs_destroy_uobject().\nrdma_restrack_del() is never reached, so the orphaned entry stays in\nthe device restrack with a valid kref, reachable by any subsequent\nnetlink dump.\n\nObserved on 6.1.52 with MLNX_OFED 24.10, after an mlx5 FW failure\nleft a process unable to tear down its CQ (destroy_cq FW command\nfailing during FD close):\n\n  WARNING: ... uverbs_destroy_ufile_hw+0xe3/0x100\n  BUG: kernel NULL pointer dereference, address: 0000000000000058\n  RIP: 0010:fill_res_cq_entry+0x15e/0x180 [ib_core]\n   res_get_common_dumpit+0x304/0x530 [ib_core]\n   nldev_res_get_cq_dumpit+0x1a/0x20 [ib_core]\n\nThe faulting chain maps to the source (CR2 = 0x58):\n  cq->uobject            (struct ib_cq +0x08, res at +0x98)\n  uobject->context       (struct ib_uobject +0x10, NULL after abandon)\n  context->res.id        (struct ib_ucontext +0x58)\n\nThe recent restrack rework (8d186210677c and its series) moved the\nrestrack deletion to the start of the destroy flow and thus fences\nconcurrent dumps from an object being destroyed, but it does not\ncover this case: when destroy fails, rdma_restrack_abort_del()\nrestores the entry, and the RDMA_REMOVE_DRIVER_FAILURE sweep still\nnever removes it from the restrack.\n\nFrom the fallback until the device is unregistered, any \"rdma res\nshow cq\" deterministically takes the NULL pointer dereference; this\nis a long-lived state, NOT A RACE. The dump path holds neither the\nrestrack lock (dropped before the fill callback runs) nor\nufile->hw_destroy_rwsem, and rdma_restrack_get() only guarantees\nthat the res memory stays alive, not that ->context is still valid.\n\nFix the dump side: check the uobject context directly instead of the\nrdma_is_kernel_res() marker. A non-NULL uobject already implies a\nuser resource, so kernel resources keep being skipped, and the\nadditional ->context check skips the RES_CTXN attribute for\norphaned entries instead of crashing the dump. The orphaned resource\nitself remains visible in \"rdma res show\" (cqn/cqe/usecnt/pid),\nwhich is what an operator needs after the accompanying uverbs WARN\nto diagnose the driver destroy failure.\n\nfill_res_pd_entry() has the same pattern (pd->uobject->context->res.id)\nand is fixed the same way; a PD can even reach the fallback without\nits own driver callback failing, e.g. uverbs_free_pd() returns -EBUSY\nwhile another object that failed to destroy still holds the PD usecnt."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"9715d98286d4660e0ebdeae13da4f78d57b246c0","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"f1681bc5ee4c9234c5f841b40a454abfc657bdc3","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"8f3709434f0ed0f349e86e1a5bce752151745987","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"abfde1965a611f6854be3d5110cf74ee6b5ade7a","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"da6bda5d4a15ddfe4489c81469f377437ca2c00b","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"98db004ba2271e9709e39c069df8912b7ae85dfa","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"8897a629706ff34f261fdb87e093c8ae174436d0","versionType":"git"},{"version":"c3d02788b45ab4a2d8f243b98c04b549c8193af6","status":"affected","lessThan":"9f4c322be27bf617cad2f4a15f6c6024a69e220c","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/infiniband/core/nldev.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.1","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.1","versionType":"semver"},{"version":"5.10.275","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","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/infiniband/core/nldev.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/9715d98286d4660e0ebdeae13da4f78d57b246c0"},{"url":"https://git.kernel.org/stable/c/f1681bc5ee4c9234c5f841b40a454abfc657bdc3"},{"url":"https://git.kernel.org/stable/c/8f3709434f0ed0f349e86e1a5bce752151745987"},{"url":"https://git.kernel.org/stable/c/abfde1965a611f6854be3d5110cf74ee6b5ade7a"},{"url":"https://git.kernel.org/stable/c/da6bda5d4a15ddfe4489c81469f377437ca2c00b"},{"url":"https://git.kernel.org/stable/c/98db004ba2271e9709e39c069df8912b7ae85dfa"},{"url":"https://git.kernel.org/stable/c/8897a629706ff34f261fdb87e093c8ae174436d0"},{"url":"https://git.kernel.org/stable/c/9f4c322be27bf617cad2f4a15f6c6024a69e220c"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:36:05.338Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"5.10.275"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"5.15.226"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"6.1.193"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"6.6.163"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"6.12.119"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}