{"id":"CVE-2025-40315","aliases":["CVE-2025-40315"],"related":[],"kind":"vulnerability","state":"published","title":"usb: gadget: f_fs: Fix epfile null pointer access after ep enable.","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget: f_fs: Fix epfile null pointer access after ep enable.\n\nA race condition occurs when ffs_func_eps_enable() runs concurrently\nwith ffs_data_reset(). The ffs_data_clear() called in ffs_data_reset()\nsets ffs->epfiles to NULL before resetting ffs->eps_count to 0, leading\nto a NULL pointer dereference when accessing epfile->ep in\nffs_func_eps_enable() after successful usb_ep_enable().\n\nThe ffs->epfiles pointer is set to NULL in both ffs_data_clear() and\nffs_data_close() functions, and its modification is protected by the\nspinlock ffs->eps_lock. And the whole ffs_func_eps_enable() function\nis also protected by ffs->eps_lock.\n\nThus, add NULL pointer handling for ffs->epfiles in the\nffs_func_eps_enable() function to fix issues","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget: f_fs: Fix epfile null pointer access after ep enable.\n\nA race condition occurs when ffs_func_eps_enable() runs concurrently\nwith ffs_data_reset(). The ffs_data_clear() called in ffs_data_reset()\nsets ffs->epfiles to NULL before resetting ffs->eps_count to 0, leading\nto a NULL pointer dereference when accessing epfile->ep in\nffs_func_eps_enable() after successful usb_ep_enable().\n\nThe ffs->epfiles pointer is set to NULL in both ffs_data_clear() and\nffs_data_close() functions, and its modification is protected by the\nspinlock ffs->eps_lock. And the whole ffs_func_eps_enable() function\nis also protected by ffs->eps_lock.\n\nThus, add NULL pointer handling for ffs->epfiles in the\nffs_func_eps_enable() function to fix issues","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nusb: gadget: f_fs: Solución al acceso a puntero nulo de epfile después de la habilitación de ep.\n\nUna condición de carrera ocurre cuando ffs_func_eps_enable() se ejecuta concurrentemente con ffs_data_reset(). La función ffs_data_clear() llamada en ffs_data_reset() establece ffs -> epfiles a NULL antes de restablecer ffs -> eps_count a 0, lo que lleva a una desreferenciación de puntero NULL al acceder a epfile -> ep en ffs_func_eps_enable() después de una usb_ep_enable() exitosa.\n\nEl puntero ffs -> epfiles se establece a NULL tanto en las funciones ffs_data_clear() como ffs_data_close(), y su modificación está protegida por el spinlock ffs -> eps_lock. Y toda la función ffs_func_eps_enable() también está protegida por ffs -> eps_lock.\n\nPor lo tanto, se añade el manejo de punteros NULL para ffs -> epfiles en la función ffs_func_eps_enable() para solucionar los problemas.","source":"nvd"}],"published":"2025-12-08T00:46:41.896Z","modified":"2026-10-14T22:10:00.210Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"c9fc422c9a43e3d58d246334a71f3390401781dc","fixed":"b00d2572c16e8e59e979960d3383c2ae9cebd195","status":"affected"},{"type":"git","introduced":"0042178a69eb77a979e36a50dcce9794a3140ef8","fixed":"1c0dbd240be3f87cac321b14e17979b7e9cb6a8f","status":"affected"},{"type":"git","introduced":"72a8aee863af099d4434314c4536d6c9a61dcf3c","fixed":"9ec40fba7357df2d36f4c2e2f3b9b1a4fba0a272","status":"affected"},{"type":"git","introduced":"ebe2b1add1055b903e2acd86b290a85297edc0b3","fixed":"c53e90563bc148e4e0ad09fe130ba2246d426ea6","status":"affected"},{"type":"git","introduced":"ebe2b1add1055b903e2acd86b290a85297edc0b3","fixed":"fc1141a530dfc91f0ee19b7f422a2d24829584bc","status":"affected"},{"type":"git","introduced":"ebe2b1add1055b903e2acd86b290a85297edc0b3","fixed":"d62b808d5c68a931ad0849a00a5e3be3dd7e0019","status":"affected"},{"type":"git","introduced":"ebe2b1add1055b903e2acd86b290a85297edc0b3","fixed":"30880e9df27332403dd638a82c27921134b3630b","status":"affected"},{"type":"git","introduced":"ebe2b1add1055b903e2acd86b290a85297edc0b3","fixed":"cfd6f1a7b42f62523c96d9703ef32b0dbc495ba4","status":"affected"},{"type":"git","version":"32048f4be071f9a6966744243f1786f45bb22dc2","status":"affected"},{"type":"git","version":"cfe5f6fd335d882bcc829a1c8a7d462a455c626e","status":"affected"},{"type":"git","version":"3e078b18753669615301d946297bafd69294ad2c","status":"affected"},{"type":"semver","introduced":"5.4.180","fixed":"5.4.302","status":"affected"},{"type":"semver","introduced":"5.10.101","fixed":"5.10.247","status":"affected"},{"type":"semver","introduced":"5.15.24","fixed":"5.15.197","status":"affected"},{"type":"semver","introduced":"4.14.267","fixed":"4.15","status":"affected"},{"type":"semver","introduced":"4.19.230","fixed":"4.20","status":"affected"},{"type":"semver","introduced":"5.16.10","fixed":"5.17","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"5.17","status":"affected"},{"type":"semver","introduced":"0","fixed":"5.17","status":"unaffected"},{"type":"semver","introduced":"5.4.302","lastAffected":"5.4.*","status":"unaffected"},{"type":"semver","introduced":"5.10.247","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.197","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.159","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.117","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.58","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.17.8","lastAffected":"6.17.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.18","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/b00d2572c16e8e59e979960d3383c2ae9cebd195","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/1c0dbd240be3f87cac321b14e17979b7e9cb6a8f","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/9ec40fba7357df2d36f4c2e2f3b9b1a4fba0a272","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/c53e90563bc148e4e0ad09fe130ba2246d426ea6","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/fc1141a530dfc91f0ee19b7f422a2d24829584bc","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/d62b808d5c68a931ad0849a00a5e3be3dd7e0019","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/30880e9df27332403dd638a82c27921134b3630b","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/cfd6f1a7b42f62523c96d9703ef32b0dbc495ba4","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-40315","url":"https://www.cve.org/CVERecord?id=CVE-2025-40315","licence":"CVE Terms of Use","modified":"2026-05-23T16:02:03.665Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-40315","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-40315","licence":"Public domain","modified":"2026-10-14T22:10:00.210Z"}],"updatedAt":"2026-11-25T22:59:08.401Z","epss":{"score":0.00216,"percentile":0.12759,"date":"2026-12-01T12:00:22.000Z"}}