usb: gadget: f_fs: Fix epfile null pointer access after ep enable.
In the Linux kernel, the following vulnerability has been resolved: usb: gadget: f_fs: Fix epfile null pointer access after ep enable. A race condition occurs when ffs_func_eps_enable() runs concurrently with ffs_data_reset(). The ffs_data_clear() called in ffs_data_reset() sets ffs->epfiles to NULL before resetting ffs->eps_count to 0, leading to a NULL pointer dereference when accessing epfile->ep in ffs_func_eps_enable() after successful usb_ep_enable(). The ffs->epfiles pointer is set to NULL in both ffs_data_clear() and ffs_data_close() functions, and its modification is protected by the spinlock ffs->eps_lock. And the whole ffs_func_eps_enable() function is also protected by ffs->eps_lock. Thus, add NULL pointer handling for ffs->epfiles in the ffs_func_eps_enable() function to fix issues
- Products
- Kernel
- Affected versions
- Not specified
- Fixed versions
- 5.10.247, 5.15.197, 5.4.302, 6.1.159, 6.12.58, 6.17.8, 6.6.117
- CVEs
- CVE-2025-40315
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 3 Nov 2026, 03:30 UTC · Revision 1
Source evidence
usb: gadget: f_fs: Fix epfile null pointer access after ep enable.
core-osv · Original sourcePublished 8 Dec 2025, 00:46 UTC
In the Linux kernel, the following vulnerability has been resolved: usb: gadget: f_fs: Fix epfile null pointer access after ep enable. A race condition occurs when ffs_func_eps_enable() runs concurrently with ffs_data_reset(). The ffs_data_clear() called in ffs_data_reset() sets ffs->epfiles to NULL before resetting ffs->eps_count to 0, leading to a NULL pointer dereference when accessing epfile->ep in ffs_func_eps_enable() after successful usb_ep_enable(). The ffs->epfiles pointer is set to NULL in both ffs_data_clear() and ffs_data_close() functions, and its modification is protected by the spinlock ffs->eps_lock. And the whole ffs_func_eps_enable() function is also protected by ffs->eps_lock. Thus, add NULL pointer handling for ffs->epfiles in the ffs_func_eps_enable() function to fix issues
osv:CVE-2025-40315
Kernel
Fixed versions: 5.4.302, 5.10.247, 5.15.197, 6.1.159, 6.6.117, 6.12.58, 6.17.8
Complete source record
{
"id": "3bcf9fa56ce08fe0abb28ae8d629835845fbdce290a153433b9425ef18e56142",
"url": "https://osv.dev/vulnerability/CVE-2025-40315",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "usb: gadget: f_fs: Fix epfile null pointer access after ep enable.",
"summary": "In the Linux kernel, the following vulnerability has been resolved: usb: gadget: f_fs: Fix epfile null pointer access after ep enable. A race condition occurs when ffs_func_eps_enable() runs concurrently with ffs_data_reset(). The ffs_data_clear() called in ffs_data_reset() sets ffs->epfiles to NULL before resetting ffs->eps_count to 0, leading to a NULL pointer dereference when accessing epfile->ep in ffs_func_eps_enable() after successful usb_ep_enable(). The ffs->epfiles pointer is set to NULL in both ffs_data_clear() and ffs_data_close() functions, and its modification is protected by the spinlock ffs->eps_lock. And the whole ffs_func_eps_enable() function is also protected by ffs->eps_lock. Thus, add NULL pointer handling for ffs->epfiles in the ffs_func_eps_enable() function to fix issues",
"evidence": "osv:CVE-2025-40315",
"products": [
{
"name": {
"value": "Kernel",
"evidence": "/affected/1/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "5.4.302",
"evidence": "/affected/1/ranges"
},
{
"value": "5.10.247",
"evidence": "/affected/1/ranges"
},
{
"value": "5.15.197",
"evidence": "/affected/1/ranges"
},
{
"value": "6.1.159",
"evidence": "/affected/1/ranges"
},
{
"value": "6.6.117",
"evidence": "/affected/1/ranges"
},
{
"value": "6.12.58",
"evidence": "/affected/1/ranges"
},
{
"value": "6.17.8",
"evidence": "/affected/1/ranges"
}
],
"affected_versions": []
}
],
"severity": "unknown",
"structured": {
"id": "CVE-2025-40315",
"aliases": [
"CVE-2025-40315"
],
"affected": [
{
"ranges": [
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "c9fc422c9a43e3d58d246334a71f3390401781dc"
},
{
"fixed": "b00d2572c16e8e59e979960d3383c2ae9cebd195"
}
]
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "0042178a69eb77a979e36a50dcce9794a3140ef8"
},
{
"fixed": "1c0dbd240be3f87cac321b14e17979b7e9cb6a8f"
}
]
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "72a8aee863af099d4434314c4536d6c9a61dcf3c"
},
{
"fixed": "9ec40fba7357df2d36f4c2e2f3b9b1a4fba0a272"
}
]
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "ebe2b1add1055b903e2acd86b290a85297edc0b3"
},
{
"fixed": "c53e90563bc148e4e0ad09fe130ba2246d426ea6"
},
{
"fixed": "fc1141a530dfc91f0ee19b7f422a2d24829584bc"
},
{
"fixed": "d62b808d5c68a931ad0849a00a5e3be3dd7e0019"
},
{
"fixed": "30880e9df27332403dd638a82c27921134b3630b"
},
{
"fixed": "cfd6f1a7b42f62523c96d9703ef32b0dbc495ba4"
}
]
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "5.4.180"
},
{
"fixed": "5.4.302"
}
]
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "5.10.101"
},
{
"fixed": "5.10.247"
}
]
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "5.15.24"
},
{
"fixed": "5.15.197"
}
]
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "4.14.267"
},
{
"fixed": "4.15"
}
]
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "4.19.230"
},
{
"fixed": "4.20"
}
]
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "5.16.10"
},
{
"fixed": "5.17"
}
]
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "32048f4be071f9a6966744243f1786f45bb22dc2"
}
]
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "cfe5f6fd335d882bcc829a1c8a7d462a455c626e"
}
]
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "3e078b18753669615301d946297bafd69294ad2c"
}
]
}
],
"versions": [
"v5.4.301",
"v5.4.300",
"v5.4.299",
"v5.4.298",
"v5.4.297",
"v5.4.296",
"v5.4.295",
"v5.4.294",
"v5.4.293",
"v5.4.292",
"v5.4.291",
"v5.4.290",
"v5.4.289",
"v5.4.288",
"v5.4.287",
"v5.4.286",
"v5.4.285",
"v5.4.284",
"v5.4.283",
"v5.4.282",
"v5.4.281",
"v5.4.280",
"v5.4.279",
"v5.4.278",
"v5.4.277",
"v5.4.276",
"v5.4.275",
"v5.4.274",
"v5.4.273",
"v5.4.272",
"v5.4.271",
"v5.4.270",
"v5.4.269",
"v5.4.268",
"v5.4.267",
"v5.4.266",
"v5.4.265",
"v5.4.264",
"v5.4.263",
"v5.4.262",
"v5.4.261",
"v5.4.260",
"v5.4.259",
"v5.4.258",
"v5.4.257",
"v5.4.256",
"v5.4.255",
"v5.4.254",
"v5.4.253",
"v5.4.252",
"v5.4.251",
"v5.4.250",
"v5.4.249",
"v5.4.248",
"v5.4.247",
"v5.4.246",
"v5.4.245",
"v5.4.244",
"v5.4.243",
"v5.4.242",
"v5.4.241",
"v5.4.240",
"v5.4.239",
"v5.4.238",
"v5.4.237",
"v5.4.236",
"v5.4.235",
"v5.4.234",
"v5.4.233",
"v5.4.232",
"v5.4.231",
"v5.4.230",
"v5.4.229",
"v5.4.228",
"v5.4.227",
"v5.4.226",
"v5.4.225",
"v5.4.224",
"v5.4.223",
"v5.4.222",
"v5.4.221",
"v5.4.220",
"v5.4.219",
"v5.4.218",
"v5.4.217",
"v5.4.216",
"v5.4.215",
"v5.4.214",
"v5.4.213",
"v5.4.212",
"v5.4.211",
"v5.4.210",
"v5.4.209",
"v5.4.208",
"v5.4.207",
"v5.4.206",
"v5.4.205",
"v5.4.204",
"v5.4.203",
"v5.4.202",
"v5.4.201",
"v5.4.200",
"v5.4.199",
"v5.4.198",
"v5.4.197",
"v5.4.196",
"v5.4.195",
"v5.4.194",
"v5.4.193",
"v5.4.192",
"v5.4.191",
"v5.4.190",
"v5.4.189",
"v5.4.188",
"v5.4.187",
"v5.4.186",
"v5.4.185",
"v5.4.184",
"v5.4.183",
"v5.4.182",
"v5.4.181",
"v5.4.180",
"v5.10.246",
"v5.10.245",
"v5.10.244",
"v5.10.243",
"v5.10.242",
"v5.10.241",
"v5.10.240",
"v5.10.239",
"v5.10.238",
"v5.10.237",
"v5.10.236",
"v5.10.235",
"v5.10.234",
"v5.10.233",
"v5.10.232",
"v5.10.231",
"v5.10.230",
"v5.10.229",
"v5.10.228",
"v5.10.227",
"v5.10.226",
"v5.10.225",
"v5.10.224",
"v5.10.223",
"v5.10.222",
"v5.10.221",
"v5.10.220",
"v5.10.219",
"v5.10.218",
"v5.10.217",
"v5.10.216",
"v5.10.215",
"v5.10.214",
"v5.10.213",
"v5.10.212",
"v5.10.211",
"v5.10.210",
"v5.10.209",
"v5.10.208",
"v5.10.207",
"v5.10.206",
"v5.10.205",
"v5.10.204",
"v5.10.203",
"v5.10.202",
"v5.10.201",
"v5.10.200",
"v5.10.199",
"v5.10.198",
"v5.10.197",
"v5.10.196",
"v5.10.195",
"v5.10.194",
"v5.10.193",
"v5.10.192",
"v5.10.191",
"v5.10.190",
"v5.10.189",
"v5.10.188",
"v5.10.187",
"v5.10.186",
"v5.10.185",
"v5.10.184",
"v5.10.183",
"v5.10.182",
"v5.10.181",
"v5.10.180",
"v5.10.179",
"v5.10.178",
"v5.10.177",
"v5.10.176",
"v5.10.175",
"v5.10.174",
"v5.10.173",
"v5.10.172",
"v5.10.171",
"v5.10.170",
"v5.10.169",
"v5.10.168",
"v5.10.167",
"v5.10.166",
"v5.10.165",
"v5.10.164",
"v5.10.163",
"v5.10.162",
"v5.10.161",
"v5.10.160",
"v5.10.159",
"v5.10.158",
"v5.10.157",
"v5.10.156",
"v5.10.155",
"v5.10.154",
"v5.10.153",
"v5.10.152",
"v5.10.151",
"v5.10.150",
"v5.10.149",
"v5.10.148",
"v5.10.147",
"v5.10.146",
"v5.10.145",
"v5.10.144",
"v5.10.143",
"v5.10.142",
"v5.10.141",
"v5.10.140",
"v5.10.139",
"v5.10.138",
"v5.10.137",
"v5.10.136",
"v5.10.135",
"v5.10.134",
"v5.10.133",
"v5.10.132",
"v5.10.131",
"v5.10.130",
"v5.10.129",
"v5.10.128",
"v5.10.127",
"v5.10.126",
"v5.10.125",
"v5.10.124",
"v5.10.123",
"v5.10.122",
"v5.10.121",
"v5.10.120",
"v5.10.119",
"v5.10.118",
"v5.10.117",
"v5.10.116",
"v5.10.115",
"v5.10.114",
"v5.10.113",
"v5.10.112",
"v5.10.111",
"v5.10.110",
"v5.10.109",
"v5.10.108",
"v5.10.107",
"v5.10.106",
"v5.10.105",
"v5.10.104",
"v5.10.103",
"v5.10.102",
"v5.10.101",
"v5.15.196",
"v5.15.195",
"v5.15.194",
"v5.15.193",
"v5.15.192",
"v5.15.191",
"v5.15.190",
"v5.15.189",
"v5.15.188",
"v5.15.187",
"v5.15.186",
"v5.15.185",
"v5.15.184",
"v5.15.183",
"v5.15.182",
"v5.15.181",
"v5.15.180",
"v5.15.179",
"v5.15.178",
"v5.15.177",
"v5.15.176",
"v5.15.175",
"v5.15.174",
"v5.15.173",
"v5.15.172",
"v5.15.171",
"v5.15.170",
"v5.15.169",
"v5.15.168",
"v5.15.167",
"v5.15.166",
"v5.15.165",
"v5.15.164",
"v5.15.163",
"v5.15.162",
"v5.15.161",
"v5.15.160",
"v5.15.159",
"v5.15.158",
"v5.15.157",
"v5.15.156",
"v5.15.155",
"v5.15.154",
"v5.15.153",
"v5.15.152",
"v5.15.151",
"v5.15.150",
"v5.15.149",
"v5.15.148",
"v5.15.147",
"v5.15.146",
"v5.15.145",
"v5.15.144",
"v5.15.143",
"v5.15.142",
"v5.15.141",
"v5.15.140",
"v5.15.139",
"v5.15.138",
"v5.15.137",
"v5.15.136",
"v5.15.135",
"v5.15.134",
"v5.15.133",
"v5.15.132",
"v5.15.131",
"v5.15.130",
"v5.15.129",
"v5.15.128",
"v5.15.127",
"v5.15.126",
"v5.15.125",
"v5.15.124",
"v5.15.123",
"v5.15.122",
"v5.15.121",
"v5.15.120",
"v5.15.119",
"v5.15.118",
"v5.15.117",
"v5.15.116",
"v5.15.115",
"v5.15.114",
"v5.15.113",
"v5.15.112",
"v5.15.111",
"v5.15.110",
"v5.15.109",
"v5.15.108",
"v5.15.107",
"v5.15.106",
"v5.15.105",
"v5.15.104",
"v5.15.103",
"v5.15.102",
"v5.15.101",
"v5.15.100",
"v5.15.99",
"v5.15.98",
"v5.15.97",
"v5.15.96",
"v5.15.95",
"v5.15.94",
"v5.15.93",
"v5.15.92",
"v5.15.91",
"v5.15.90",
"v5.15.89",
"v5.15.88",
"v5.15.87",
"v5.15.86",
"v5.15.85",
"v5.15.84",
"v5.15.83",
"v5.15.82",
"v5.15.81",
"v5.15.80",
"v5.15.79",
"v5.15.78",
"v5.15.77",
"v5.15.76",
"v5.15.75",
"v5.15.74",
"v5.15.73",
"v5.15.72",
"v5.15.71",
"v5.15.70",
"v5.15.69",
"v5.15.68",
"v5.15.67",
"v5.15.66",
"v5.15.65",
"v5.15.64",
"v5.15.63",
"v5.15.62",
"v5.15.61",
"v5.15.60",
"v5.15.59",
"v5.15.58",
"v5.15.57",
"v5.15.56",
"v5.15.55",
"v5.15.54",
"v5.15.53",
"v5.15.52",
"v5.15.51",
"v5.15.50",
"v5.15.49",
"v5.15.48",
"v5.15.47",
"v5.15.46",
"v5.15.45",
"v5.15.44",
"v5.15.43",
"v5.15.42",
"v5.15.41",
"v5.15.40",
"v5.15.39",
"v5.15.38",
"v5.15.37",
"v5.15.36",
"v5.15.35",
"v5.15.34",
"v5.15.33",
"v5.15.32",
"v5.15.31",
"v5.15.30",
"v5.15.29",
"v5.15.28",
"v5.15.27",
"v5.15.26",
"v5.15.25",
"v5.15.24",
"v4.14.336",
"v4.14.335",
"v4.14.334",
"v4.14.333",
"v4.14.332",
"v4.14.331",
"v4.14.330",
"v4.14.329",
"v4.14.328",
"v4.14.327",
"v4.14.326",
"v4.14.325",
"v4.14.324",
"v4.14.323",
"v4.14.322",
"v4.14.321",
"v4.14.320",
"v4.14.319",
"v4.14.318",
"v4.14.317",
"v4.14.316",
"v4.14.315",
"v4.14.314",
"v4.14.313",
"v4.14.312",
"v4.14.311",
"v4.14.310",
"v4.14.309",
"v4.14.308",
"v4.14.307",
"v4.14.306",
"v4.14.305",
"v4.14.304",
"v4.14.303",
"v4.14.302",
"v4.14.301",
"v4.14.300",
"v4.14.299",
"v4.14.298",
"v4.14.297",
"v4.14.296",
"v4.14.295",
"v4.14.294",
"v4.14.293",
"v4.14.292",
"v4.14.291",
"v4.14.290",
"v4.14.289",
"v4.14.288",
"v4.14.287",
"v4.14.286",
"v4.14.285",
"v4.14.284",
"v4.14.283",
"v4.14.282",
"v4.14.281",
"v4.14.280",
"v4.14.279",
"v4.14.278",
"v4.14.277",
"v4.14.276",
"v4.14.275",
"v4.14.274",
"v4.14.273",
"v4.14.272",
"v4.14.271",
"v4.14.270",
"v4.14.269",
"v4.14.268",
"v4.14.267",
"v4.19.325",
"v4.19.324",
"v4.19.323",
"v4.19.322",
"v4.19.321",
"v4.19.320",
"v4.19.319",
"v4.19.318",
"v4.19.317",
"v4.19.316",
"v4.19.315",
"v4.19.314",
"v4.19.313",
"v4.19.312",
"v4.19.311",
"v4.19.310",
"v4.19.309",
"v4.19.308",
"v4.19.307",
"v4.19.306",
"v4.19.305",
"v4.19.304",
"v4.19.303",
"v4.19.302",
"v4.19.301",
"v4.19.300",
"v4.19.299",
"v4.19.298",
"v4.19.297",
"v4.19.296",
"v4.19.295",
"v4.19.294",
"v4.19.293",
"v4.19.292",
"v4.19.291",
"v4.19.290",
"v4.19.289",
"v4.19.288",
"v4.19.287",
"v4.19.286",
"v4.19.285",
"v4.19.284",
"v4.19.283",
"v4.19.282",
"v4.19.281",
"v4.19.280",
"v4.19.279",
"v4.19.278",
"v4.19.277",
"v4.19.276",
"v4.19.275",
"v4.19.274",
"v4.19.273",
"v4.19.272",
"v4.19.271",
"v4.19.270",
"v4.19.269",
"v4.19.268",
"v4.19.267",
"v4.19.266",
"v4.19.265",
"v4.19.264",
"v4.19.263",
"v4.19.262",
"v4.19.261",
"v4.19.260",
"v4.19.259",
"v4.19.258",
"v4.19.257",
"v4.19.256",
"v4.19.255",
"v4.19.254",
"v4.19.253",
"v4.19.252",
"v4.19.251",
"v4.19.250",
"v4.19.249",
"v4.19.248",
"v4.19.247",
"v4.19.246",
"v4.19.245",
"v4.19.244",
"v4.19.243",
"v4.19.242",
"v4.19.241",
"v4.19.240",
"v4.19.239",
"v4.19.238",
"v4.19.237",
"v4.19.236",
"v4.19.235",
"v4.19.234",
"v4.19.233",
"v4.19.232",
"v4.19.231",
"v4.19.230",
"v5.16.20",
"v5.16.19",
"v5.16.18",
"v5.16.17",
"v5.16.16",
"v5.16.15",
"v5.16.14",
"v5.16.13",
"v5.16.12",
"v5.16.11",
"v5.16.10"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-40315.json"
}
},
{
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "0"
},
{
"fixed": "5.4.302"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "5.5.0"
},
{
"fixed": "5.10.247"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "5.11.0"
},
{
"fixed": "5.15.197"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "5.16.0"
},
{
"fixed": "6.1.159"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "5.17.0"
},
{
"fixed": "6.6.117"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.2.0"
},
{
"fixed": "6.12.58"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.7.0"
},
{
"fixed": "6.17.8"
}
]
}
],
"package": {
"name": "Kernel",
"ecosystem": "Linux"
},
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-40315.json"
}
}
],
"modified": "2026-10-28T02:30:25.872329412Z",
"provider": "osv",
"references": [
"https://git.kernel.org/stable/c/1c0dbd240be3f87cac321b14e17979b7e9cb6a8f",
"https://git.kernel.org/stable/c/30880e9df27332403dd638a82c27921134b3630b",
"https://git.kernel.org/stable/c/9ec40fba7357df2d36f4c2e2f3b9b1a4fba0a272",
"https://git.kernel.org/stable/c/b00d2572c16e8e59e979960d3383c2ae9cebd195",
"https://git.kernel.org/stable/c/c53e90563bc148e4e0ad09fe130ba2246d426ea6",
"https://git.kernel.org/stable/c/cfd6f1a7b42f62523c96d9703ef32b0dbc495ba4",
"https://git.kernel.org/stable/c/d62b808d5c68a931ad0849a00a5e3be3dd7e0019",
"https://git.kernel.org/stable/c/fc1141a530dfc91f0ee19b7f422a2d24829584bc",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/40xxx/CVE-2025-40315.json",
"https://nvd.nist.gov/vuln/detail/CVE-2025-40315",
"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
],
"provider_metadata": {
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/40xxx/CVE-2025-40315.json"
}
},
"related_cves": [
{
"value": "CVE-2025-40315",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": null
},
"source_id": "core-osv",
"document_id": 492200,
"published_at": "2025-12-08T00:46:41.896+00:00"
}