CVE-2026-98688: thunderbolt: Fix NULL dereference in tb_remove_work()
In the Linux kernel, the following vulnerability has been resolved:
thunderbolt: Fix NULL dereference in tbremovework()
There is a slight race between tbremovework() and tbdomainremove() which leads to dereferencing a NULL tb->rootswitch pointer inside tbfreeunpluggedxdomains():
Thread A Thread B
tbremovework() tbdomainremove() mutexlock(&tb->lock) tbstop() / doesn't cancel a running callback / canceldelayedwork(&tcm->removework) ... tbswitchremove(tb->rootswitch) tb->rootswitch = NULL mutexunlock(&tb->lock) mutexlock(&tb->lock) ... / without checking ->rootswitch / tbfreeunpluggedxdomains(tb->rootswitch) mutexunlock(&tb->lock)
Commit a8937f35cf39 ("thunderbolt: Remove XDomain from the bus without holding tb->lock") doesn't seem right to move tbfreeunpluggedxdomains() out of the &tb->lock section and the check for tb->rootswitch, in particular. It states:
For this reason separate removing the XDomain from the topology data structures (where we need the lock) from unregistering the device from the bus (where remove callbacks of the drivers are being called).
tbfreeunpluggedxdomains() belongs to the former group of functions requiring the lock. And it also calls tbxdomainremove() which should only be called with &tb->lock held.
Found by Linux Verification Center (linuxtesting.org) with Svace static analysis tool.