{"id":71950,"date":"2025-10-18T11:45:34","date_gmt":"2025-10-18T08:15:34","guid":{"rendered":"https:\/\/afaghhosting.net\/blog\/cve-2025-40002-thunderbolt-fix-use-after-free-in-tb_dp_dprx_work\/"},"modified":"2025-10-18T11:45:34","modified_gmt":"2025-10-18T08:15:34","slug":"cve-2025-40002-thunderbolt-fix-use-after-free-in-tb_dp_dprx_work","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/cve-2025-40002-thunderbolt-fix-use-after-free-in-tb_dp_dprx_work\/","title":{"rendered":"CVE-2025-40002 &#8211; thunderbolt: Fix use-after-free in tb_dp_dprx_work"},"content":{"rendered":"<p>CVE ID : CVE-2025-40002<\/p>\n<p>Published :  Oct. 18, 2025, 8:15 a.m. | 25\u00a0minutes ago<\/p>\n<p>Description : In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>thunderbolt: Fix use-after-free in tb_dp_dprx_work<\/p>\n<p>The original code relies on cancel_delayed_work() in tb_dp_dprx_stop(),<br \/>\nwhich does not ensure that the delayed work item tunnel-&gt;dprx_work has<br \/>\nfully completed if it was already running. This leads to use-after-free<br \/>\nscenarios where tb_tunnel is deallocated by tb_tunnel_put(), while<br \/>\ntunnel-&gt;dprx_work remains active and attempts to dereference tb_tunnel<br \/>\nin tb_dp_dprx_work().<\/p>\n<p>A typical race condition is illustrated below:<\/p>\n<p>CPU 0                            | CPU 1<br \/>\ntb_dp_tunnel_active()            |<br \/>\n  tb_deactivate_and_free_tunnel()| tb_dp_dprx_start()<br \/>\n    tb_tunnel_deactivate()       |   queue_delayed_work()<br \/>\n      tb_dp_activate()           |<br \/>\n        tb_dp_dprx_stop()        | tb_dp_dprx_work() \/\/delayed worker<br \/>\n          cancel_delayed_work()  |<br \/>\n    tb_tunnel_put(tunnel);       |<br \/>\n                                 |   tunnel = container_of(&#8230;); \/\/UAF<br \/>\n                                 |   tunnel-&gt; \/\/UAF<\/p>\n<p>Replacing cancel_delayed_work() with cancel_delayed_work_sync() is<br \/>\nnot feasible as it would introduce a deadlock: both tb_dp_dprx_work()<br \/>\nand the cleanup path acquire tb-&gt;lock, and cancel_delayed_work_sync()<br \/>\nwould wait indefinitely for the work item that cannot proceed.<\/p>\n<p>Instead, implement proper reference counting:<br \/>\n&#8211; If cancel_delayed_work() returns true (work is pending), we release<br \/>\n  the reference in the stop function.<br \/>\n&#8211; If it returns false (work is executing or already completed), the<br \/>\n  reference is released in delayed work function itself.<\/p>\n<p>This ensures the tb_tunnel remains valid during work item execution<br \/>\nwhile preventing memory leaks.<\/p>\n<p>This bug was found by static analysis.<\/p>\n<p>Severity: 0.0 | NA<\/p>\n<p>Visit the link for more details, such as CVSS details, affected products, timeline, and more&#8230;\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CVE ID : CVE-2025-40002 Published : Oct. 18, 2025, 8:15 a.m. | 25\u00a0minutes ago Description : In the Linux kernel, the following vulnerability has been resolved: thunderbolt: Fix use-after-free in tb_dp_dprx_work The original code relies on cancel_delayed_work() in tb_dp_dprx_stop(), which does not ensure that the delayed work item tunnel-&gt;dprx_work has fully completed if it was &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-71950","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/71950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=71950"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/71950\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=71950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=71950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=71950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}