{"id":"CVE-2025-22074","state":"PUBLISHED","title":"ksmbd: fix r_count dec/increment mismatch","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nksmbd: fix r_count dec/increment mismatch\n\nr_count is only increased when there is an oplock break wait,\nso r_count inc/decrement are not paired. This can cause r_count\nto become negative, which can lead to a problem where the ksmbd\nthread does not terminate.","publishedAt":"2025-04-16T14:12:25.921Z","updatedAt":"2026-10-30T12:21:13.575Z","severity":{"score":8.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"8e6508c7ecb1802909f294827eff38f301d0c937","status":"affected","lessThan":"8829849da3f68697b830a5b36047b0d8a50ae3ed","versionType":"git"},{"version":"09aeab68033161cb54f194da93e51a11aee6144b","status":"affected","lessThan":"4790bcb269e5d6d88200a67c54ae6d627332a3be","versionType":"git"},{"version":"a4261bbc33fbf99b99c80aa3a2c5097611802980","status":"affected","lessThan":"457db486203c90e10c3efc87fd45cc7000b1cd36","versionType":"git"},{"version":"f17d1c63a76b0fe8e9c78023a86507a3a6d62cfa","status":"affected","lessThan":"20378cf48359f39dee0ef9b61470ebe77bd49c0d","versionType":"git"},{"version":"3aa660c059240e0c795217182cf7df32909dd917","status":"affected","lessThan":"c2ec33d46b4d1c8085dab5d02e00b21f4f0fb8a9","versionType":"git"},{"version":"3aa660c059240e0c795217182cf7df32909dd917","status":"affected","lessThan":"ddb7ea36ba7129c2ed107e2186591128618864e1","versionType":"git"},{"version":"6.6.84","status":"affected","lessThan":"6.6.87","versionType":"semver"},{"version":"6.12.20","status":"affected","lessThan":"6.12.23","versionType":"semver"},{"version":"6.13.8","status":"affected","lessThan":"6.13.11","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/server/oplock.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.14","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.14","versionType":"semver"},{"version":"6.6.87","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.23","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.13.11","status":"unaffected","lessThanOrEqual":"6.13.*","versionType":"semver"},{"version":"6.14.2","status":"unaffected","lessThanOrEqual":"6.14.*","versionType":"semver"},{"version":"6.15","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/server/oplock.c"]}],"references":["https://git.kernel.org/stable/c/8829849da3f68697b830a5b36047b0d8a50ae3ed","https://git.kernel.org/stable/c/4790bcb269e5d6d88200a67c54ae6d627332a3be","https://git.kernel.org/stable/c/457db486203c90e10c3efc87fd45cc7000b1cd36","https://git.kernel.org/stable/c/20378cf48359f39dee0ef9b61470ebe77bd49c0d","https://git.kernel.org/stable/c/c2ec33d46b4d1c8085dab5d02e00b21f4f0fb8a9","https://git.kernel.org/stable/c/ddb7ea36ba7129c2ed107e2186591128618864e1"],"weaknesses":[],"ingestedAt":"2026-10-30T12:38:04.623Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/22xxx/CVE-2025-22074.json","commit":"db8103c5921aac81d5d90efcf3745980dafabf49","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-22074","state":"PUBLISHED","datePublished":"2025-04-16T14:12:25.921Z","dateUpdated":"2026-10-30T12:21:13.575Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-12-29T08:45:45.814Z"},"containers":{"cna":{"title":"ksmbd: fix r_count dec/increment mismatch","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nksmbd: fix r_count dec/increment mismatch\n\nr_count is only increased when there is an oplock break wait,\nso r_count inc/decrement are not paired. This can cause r_count\nto become negative, which can lead to a problem where the ksmbd\nthread does not terminate."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"8e6508c7ecb1802909f294827eff38f301d0c937","status":"affected","lessThan":"8829849da3f68697b830a5b36047b0d8a50ae3ed","versionType":"git"},{"version":"09aeab68033161cb54f194da93e51a11aee6144b","status":"affected","lessThan":"4790bcb269e5d6d88200a67c54ae6d627332a3be","versionType":"git"},{"version":"a4261bbc33fbf99b99c80aa3a2c5097611802980","status":"affected","lessThan":"457db486203c90e10c3efc87fd45cc7000b1cd36","versionType":"git"},{"version":"f17d1c63a76b0fe8e9c78023a86507a3a6d62cfa","status":"affected","lessThan":"20378cf48359f39dee0ef9b61470ebe77bd49c0d","versionType":"git"},{"version":"3aa660c059240e0c795217182cf7df32909dd917","status":"affected","lessThan":"c2ec33d46b4d1c8085dab5d02e00b21f4f0fb8a9","versionType":"git"},{"version":"3aa660c059240e0c795217182cf7df32909dd917","status":"affected","lessThan":"ddb7ea36ba7129c2ed107e2186591128618864e1","versionType":"git"},{"version":"6.6.84","status":"affected","lessThan":"6.6.87","versionType":"semver"},{"version":"6.12.20","status":"affected","lessThan":"6.12.23","versionType":"semver"},{"version":"6.13.8","status":"affected","lessThan":"6.13.11","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/server/oplock.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.14","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.14","versionType":"semver"},{"version":"6.6.87","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.23","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.13.11","status":"unaffected","lessThanOrEqual":"6.13.*","versionType":"semver"},{"version":"6.14.2","status":"unaffected","lessThanOrEqual":"6.14.*","versionType":"semver"},{"version":"6.15","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/server/oplock.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/8829849da3f68697b830a5b36047b0d8a50ae3ed"},{"url":"https://git.kernel.org/stable/c/4790bcb269e5d6d88200a67c54ae6d627332a3be"},{"url":"https://git.kernel.org/stable/c/457db486203c90e10c3efc87fd45cc7000b1cd36"},{"url":"https://git.kernel.org/stable/c/20378cf48359f39dee0ef9b61470ebe77bd49c0d"},{"url":"https://git.kernel.org/stable/c/c2ec33d46b4d1c8085dab5d02e00b21f4f0fb8a9"},{"url":"https://git.kernel.org/stable/c/ddb7ea36ba7129c2ed107e2186591128618864e1"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":8.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:N - ksmbd is the in-kernel SMB server listening on TCP/445; the oplock/lease break path is driven entirely by SMB2 CREATE/WRITE/SET_INFO requests sent by a remote peer over the network.\nAC:L - The attacker owns both connections involved (the oplock holder and the breaker) and controls exactly how many unbalanced decrements occur by sending N writes, so `r_count` can be steered to zero or negative deterministically; no condition outside the attacker's control is needed.\nPR:L - Obtaining a level-II oplock or read-caching lease requires an open file handle, which requires a completed SMB2 session setup and tree connect with valid credentials — a low-privileged authenticated share user suffices.\nUI:N - The attacker triggers the oplock break itself by writing to or truncating the file from a second connection; no action by any local user or administrator is required.\nS:U - The corruption and its consequences (hung ksmbd kthread, freed ksmbd_conn/transport reuse) remain entirely within the kernel's own security authority.\nC:H - The underflow lets the connection teardown free `ksmbd_conn`, the transport and the socket while an in-flight work item still dereferences them, and the attacker can reoccupy that slab with request-buffer data, yielding a use-after-free read primitive over kernel memory including session keys and credentials.\nI:H - The same use-after-free gives writes through the stale `work->conn`/`work->sess` pointers and via `ksmbd_conn_write()` into freed and reallocated memory, which is the standard basis for heap-spray-driven control-flow hijacking.\nA:H - A negative `r_count` makes `wait_event(conn->r_count_q, r_count == 0)` unsatisfiable, hanging the `ksmbd:%u` kthread uninterruptibly and permanently leaking the socket, connection and sessions; this is repeatable per connection until resources are exhausted, and the UAF variant additionally causes kernel oopses."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-10-30T12:21:13.575Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6.84","versionEndExcluding":"6.6.87"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12.20","versionEndExcluding":"6.12.23"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.13.8","versionEndExcluding":"6.13.11"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.14","versionEndExcluding":"6.14.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.14","versionEndExcluding":"6.15"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}