{"id":"CVE-2025-40256","summary":"xfrm: also call xfrm_state_delete_tunnel at destroy time for states that were never added","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nxfrm: also call xfrm_state_delete_tunnel at destroy time for states that were never added\n\nIn commit b441cf3f8c4b (\"xfrm: delete x-\u003etunnel as we delete x\"), I\nmissed the case where state creation fails between full\ninitialization (-\u003einit_state has been called) and being inserted on\nthe lists.\n\nIn this situation, -\u003einit_state has been called, so for IPcomp\ntunnels, the fallback tunnel has been created and added onto the\nlists, but the user state never gets added, because we fail before\nthat. The user state doesn't go through __xfrm_state_delete, so we\ndon't call xfrm_state_delete_tunnel for those states, and we end up\nleaking the FB tunnel.\n\nThere are several codepaths affected by this: the add/update paths, in\nboth net/key and xfrm, and the migrate code (xfrm_migrate,\nxfrm_state_migrate). A \"proper\" rollback of the init_state work would\nprobably be doable in the add/update code, but for migrate it gets\nmore complicated as multiple states may be involved.\n\nAt some point, the new (not-inserted) state will be destroyed, so call\nxfrm_state_delete_tunnel during xfrm_state_gc_destroy. Most states\nwill have their fallback tunnel cleaned up during __xfrm_state_delete,\nwhich solves the issue that b441cf3f8c4b (and other patches before it)\naimed at. All states (including FB tunnels) will be removed from the\nlists once xfrm_state_fini has called flush_work(&xfrm_state_gc_work).","modified":"2026-03-31T17:29:46.379632774Z","published":"2025-12-04T16:08:17.756Z","related":["SUSE-SU-2026:0263-1","SUSE-SU-2026:0278-1","SUSE-SU-2026:0281-1","SUSE-SU-2026:0293-1","SUSE-SU-2026:0315-1","SUSE-SU-2026:0316-1","SUSE-SU-2026:0317-1","SUSE-SU-2026:0350-1","SUSE-SU-2026:0369-1","SUSE-SU-2026:0411-1","SUSE-SU-2026:0617-1","SUSE-SU-2026:20207-1","SUSE-SU-2026:20220-1","SUSE-SU-2026:20228-1","SUSE-SU-2026:20477-1","SUSE-SU-2026:20498-1","SUSE-SU-2026:20845-1","SUSE-SU-2026:20876-1","openSUSE-SU-2026:20145-1"],"database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/40xxx/CVE-2025-40256.json"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/10deb69864840ccf96b00ac2ab3a2055c0c04721"},{"type":"WEB","url":"https://git.kernel.org/stable/c/1dad653643f28ccc89be93f9440b8804cded85b2"},{"type":"WEB","url":"https://git.kernel.org/stable/c/57b72d74d4651dc19d046308a8304eb9abfe66ac"},{"type":"WEB","url":"https://git.kernel.org/stable/c/64441724387b4ac92f67ef51caaaeffe99c950d1"},{"type":"WEB","url":"https://git.kernel.org/stable/c/763e5c351206c1e4d910db4a1159053f6263689c"},{"type":"WEB","url":"https://git.kernel.org/stable/c/d6fe5c740c573af10943b8353992e1325cdb2715"},{"type":"WEB","url":"https://git.kernel.org/stable/c/f7d879c19d306512c2e260f37e8a3e5c85e37c50"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/40xxx/CVE-2025-40256.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-40256"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"1b28a7fae0128fa140a7dccd995182ff6cd1c67b"},{"fixed":"57b72d74d4651dc19d046308a8304eb9abfe66ac"}]},{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"4b2c17d0f9be8b58bb30468bc81a4b61c985b04e"},{"fixed":"1dad653643f28ccc89be93f9440b8804cded85b2"}]},{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"0da961fa46da1b37ef868d9b603bd202136f8f8e"},{"fixed":"64441724387b4ac92f67ef51caaaeffe99c950d1"}]},{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"d0e0d1097118461463b76562c7ebaabaa5b90b13"},{"fixed":"763e5c351206c1e4d910db4a1159053f6263689c"}]},{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"dc3636912d41770466543623cb76e7b88fdb42c7"},{"fixed":"f7d879c19d306512c2e260f37e8a3e5c85e37c50"}]},{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"b441cf3f8c4b8576639d20c8eb4aa32917602ecd"},{"fixed":"d6fe5c740c573af10943b8353992e1325cdb2715"},{"fixed":"10deb69864840ccf96b00ac2ab3a2055c0c04721"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-40256.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.16.0"},{"fixed":"6.17.10"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-40256.json"}}],"schema_version":"1.7.5"}