{"id":"CVE-2026-139584","summary":"IB/mad: fix UAF and double-free in RMPP receive reassembly","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nIB/mad: fix UAF and double-free in RMPP receive reassembly\n\nmad_rmpp_recv.state is protected by two locks that do not exclude\neach other: recv_timeout_handler() (port workqueue) uses agent-\u003elock,\ncontinue_rmpp() (CQ softirq) uses rmpp_recv-\u003elock. Nothing serializes\nthe check-then-set sequence on the state word:\n\n  T1 (CQ softirq)              T2 (port workqueue)\n  continue_rmpp()\n    lock(rmpp_recv-\u003elock)\n    state == ACTIVE  [passes]\n                               recv_timeout_handler()\n                                 lock(agent-\u003elock)\n                                 state = TIMEOUT\n                                 list_del(&rmpp_recv-\u003elist)\n                                 unlock(agent-\u003elock)\n                                 destroy_rmpp_recv()\n                                   wait_for_completion()\n                                   [blocks on T1's ref]\n    state = COMPLETE\n    unlock(rmpp_recv-\u003elock)\n    complete_rmpp()\n      queue cleanup_work (+10s)\n    deref()\n                               [unblocks]\n                               kfree(rmpp_recv)\n                               ib_free_recv_mad(done_wc)\n\n  +10s: recv_cleanup_handler() runs lock/list_del/destroy on the\n        freed rmpp_recv -\u003e UAF write and double free; nothing can\n        cancel that cleanup_work anymore, the entry is already off\n        agent-\u003ermpp_list. done_wc is also returned to\n        ib_mad_complete_recv() and freed again -\u003e UAF read and\n        double free.\n\nReaching this requires sending MADs to a kernel RMPP agent from the\nInfiniBand/RoCE fabric: the per-port sa_query agent accepts subnet\nmanager responses whose SLID/GID/TID are not authenticated on the\nfabric, and legacy user_mad agents registered without\nIB_USER_MAD_USER_RMPP start reassembly on any incoming RMPP DATA\nMAD with an attacker-chosen TID, no in-flight send required. The\nattacker controls segment timing and can run many transactions in\nparallel (agent-\u003ermpp_list has no cap), so landing the\nmicroseconds-wide receive critical section on the 40-second timeout\nboundary is a matter of patience, not luck.\n\nUnify state transitions under rmpp_recv-\u003elock in\nrecv_timeout_handler(), keeping list manipulation under agent-\u003elock\n(which preserves the agent-\u003elock -\u003e rmpp_recv-\u003elock ordering used\nby continue_rmpp()). State check/set in both paths is then\nserialized, so the loser of the race always observes the final\nstate and bails out. recv_cleanup_handler() needs no change: with\ntransitions serialized, a cleanup_work can only be pending after\nCOMPLETE, in which case the timeout handler exits early.\n\nThe race is as old as the RMPP implementation itself.","modified":"2026-11-30T15:02:29.338774709Z","published":"2026-11-30T13:36:06.428Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/139xxx/CVE-2026-139584.json","cna_assigner":"Linux"},"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/1391b9d5db622cc883e945cc0b66666f2995bfca"},{"type":"WEB","url":"https://git.kernel.org/stable/c/2eab6afb62da0b29b731ee76f07658bda0b1dd19"},{"type":"WEB","url":"https://git.kernel.org/stable/c/90e9b6357bec75f627cde1a85b5887215c80aad8"},{"type":"WEB","url":"https://git.kernel.org/stable/c/9edaa226ea03da865204e67f745ee974806136e3"},{"type":"WEB","url":"https://git.kernel.org/stable/c/ae817ef1690cadb9bb176a814f6d1d386d0a544e"},{"type":"WEB","url":"https://git.kernel.org/stable/c/bebbe1555677dbfa3542d2d2caa58a9adf4ec859"},{"type":"WEB","url":"https://git.kernel.org/stable/c/d8ef8b4626d9df682bdb27be8c039f9532f07740"},{"type":"WEB","url":"https://git.kernel.org/stable/c/e936a56c1ab8ba5d07938812b934b8b1d8b56dc7"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/139xxx/CVE-2026-139584.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139584"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"fa619a77046bef30478697aba0553991033afb8e"},{"fixed":"e936a56c1ab8ba5d07938812b934b8b1d8b56dc7"},{"fixed":"d8ef8b4626d9df682bdb27be8c039f9532f07740"},{"fixed":"bebbe1555677dbfa3542d2d2caa58a9adf4ec859"},{"fixed":"ae817ef1690cadb9bb176a814f6d1d386d0a544e"},{"fixed":"2eab6afb62da0b29b731ee76f07658bda0b1dd19"},{"fixed":"1391b9d5db622cc883e945cc0b66666f2995bfca"},{"fixed":"9edaa226ea03da865204e67f745ee974806136e3"},{"fixed":"90e9b6357bec75f627cde1a85b5887215c80aad8"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-139584.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"2.6.13"},{"fixed":"5.10.275"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.11.0"},{"fixed":"5.15.226"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.16.0"},{"fixed":"6.1.193"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.2.0"},{"fixed":"6.6.163"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.7.0"},{"fixed":"6.12.119"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.65"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.6"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-139584.json"}}],"schema_version":"1.9.2"}