ksmbd: serialize QUERY_DIRECTORY requests per file
In the Linux kernel, the following vulnerability has been resolved: ksmbd: serialize QUERY_DIRECTORY requests per file smb2_query_dir() stores a pointer to its stack-allocated private data in the ksmbd_file readdir_data. Concurrent QUERY_DIRECTORY requests using the same file handle can overwrite this pointer while an iterate_dir() callback is still using it, resulting in a stack use-after-free. Add a per-file mutex and hold it while accessing the shared directory enumeration state. The lock covers scan restart, dot entry state, readdir_data setup and iteration, and response construction. This prevents another request from replacing readdir_data.private before the current request has finished using it and also serializes the shared file position.
- Products
- Kernel
- Affected versions
- Not specified
- Fixed versions
- 6.1.178, 6.12.96, 6.18.39, 6.6.145, 7.1.4
- CVEs
- CVE-2026-64397
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 5 Nov 2026, 10:34 UTC · Revision 1
Source evidence
ksmbd: serialize QUERY_DIRECTORY requests per file
core-osv · Original sourcePublished 25 Jul 2026, 08:50 UTC
In the Linux kernel, the following vulnerability has been resolved: ksmbd: serialize QUERY_DIRECTORY requests per file smb2_query_dir() stores a pointer to its stack-allocated private data in the ksmbd_file readdir_data. Concurrent QUERY_DIRECTORY requests using the same file handle can overwrite this pointer while an iterate_dir() callback is still using it, resulting in a stack use-after-free. Add a per-file mutex and hold it while accessing the shared directory enumeration state. The lock covers scan restart, dot entry state, readdir_data setup and iteration, and response construction. This prevents another request from replacing readdir_data.private before the current request has finished using it and also serializes the shared file position.
osv:CVE-2026-64397
Kernel
Fixed versions: 6.1.178, 6.6.145, 6.12.96, 6.18.39, 7.1.4
Complete source record
{
"id": "9586ba26e0538f6bb87edd74ca8b42cc930c0702b46bc955c54d2c0e0967f44d",
"url": "https://osv.dev/vulnerability/CVE-2026-64397",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "ksmbd: serialize QUERY_DIRECTORY requests per file",
"summary": "In the Linux kernel, the following vulnerability has been resolved: ksmbd: serialize QUERY_DIRECTORY requests per file smb2_query_dir() stores a pointer to its stack-allocated private data in the ksmbd_file readdir_data. Concurrent QUERY_DIRECTORY requests using the same file handle can overwrite this pointer while an iterate_dir() callback is still using it, resulting in a stack use-after-free. Add a per-file mutex and hold it while accessing the shared directory enumeration state. The lock covers scan restart, dot entry state, readdir_data setup and iteration, and response construction. This prevents another request from replacing readdir_data.private before the current request has finished using it and also serializes the shared file position.",
"evidence": "osv:CVE-2026-64397",
"products": [
{
"name": {
"value": "Kernel",
"evidence": "/affected/1/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "6.1.178",
"evidence": "/affected/1/ranges"
},
{
"value": "6.6.145",
"evidence": "/affected/1/ranges"
},
{
"value": "6.12.96",
"evidence": "/affected/1/ranges"
},
{
"value": "6.18.39",
"evidence": "/affected/1/ranges"
},
{
"value": "7.1.4",
"evidence": "/affected/1/ranges"
}
],
"affected_versions": []
}
],
"severity": "critical",
"structured": {
"id": "CVE-2026-64397",
"aliases": [
"CVE-2026-64397"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9"
},
{
"fixed": "1426fd79102539bc0ab5c8fced047ad4313b9908"
},
{
"fixed": "2a64dbf9c739ddf7a25a066507597bf89f8f73d2"
},
{
"fixed": "64dac2d486ec1eb18dc00968b16a230b6b75ec24"
},
{
"fixed": "a1d5d31cad593ea5e1b637f2f39c9ef6d09d1199"
},
{
"fixed": "fd22b039a5a05bc1d6818e9dcd1001fb432a829d"
},
{
"fixed": "be6d26bf27499977c746abc163659915082348d8"
}
]
}
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-64397.json"
}
},
{
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "5.15.0"
},
{
"fixed": "6.1.178"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.2.0"
},
{
"fixed": "6.6.145"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.7.0"
},
{
"fixed": "6.12.96"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.13.0"
},
{
"fixed": "6.18.39"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.19.0"
},
{
"fixed": "7.1.4"
}
]
}
],
"package": {
"name": "Kernel",
"ecosystem": "Linux"
},
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-64397.json"
}
}
],
"modified": "2026-10-28T02:30:43.785476989Z",
"provider": "osv",
"references": [
"https://git.kernel.org/stable/c/1426fd79102539bc0ab5c8fced047ad4313b9908",
"https://git.kernel.org/stable/c/2a64dbf9c739ddf7a25a066507597bf89f8f73d2",
"https://git.kernel.org/stable/c/64dac2d486ec1eb18dc00968b16a230b6b75ec24",
"https://git.kernel.org/stable/c/a1d5d31cad593ea5e1b637f2f39c9ef6d09d1199",
"https://git.kernel.org/stable/c/be6d26bf27499977c746abc163659915082348d8",
"https://git.kernel.org/stable/c/fd22b039a5a05bc1d6818e9dcd1001fb432a829d",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/64xxx/CVE-2026-64397.json",
"https://nvd.nist.gov/vuln/detail/CVE-2026-64397",
"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/2026/64xxx/CVE-2026-64397.json"
}
},
"related_cves": [
{
"value": "CVE-2026-64397",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 511638,
"published_at": "2026-07-25T08:50:41.62+00:00"
}