{"id":"CVE-2025-40302","state":"PUBLISHED","title":"media: videobuf2: forbid remove_bufs when legacy fileio is active","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nmedia: videobuf2: forbid remove_bufs when legacy fileio is active\n\nvb2_ioctl_remove_bufs() call manipulates queue internal buffer list,\npotentially overwriting some pointers used by the legacy fileio access\nmode. Forbid that ioctl when fileio is active to protect internal queue\nstate between subsequent read/write calls.","publishedAt":"2025-12-08T00:46:26.293Z","updatedAt":"2026-10-15T22:02:43.093Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/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":"a3293a85381ec9680aa2929547fbc76c5d87a1b2","status":"affected","lessThan":"a6a493b985bfffac097a4e1be09f98b27729dca8","versionType":"git"},{"version":"a3293a85381ec9680aa2929547fbc76c5d87a1b2","status":"affected","lessThan":"e819b34df0a7030a15c968d619fa8a3ed2455c7a","versionType":"git"},{"version":"a3293a85381ec9680aa2929547fbc76c5d87a1b2","status":"affected","lessThan":"27afd6e066cfd80ddbe22a4a11b99174ac89cced","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/media/common/videobuf2/videobuf2-v4l2.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.10","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.10","versionType":"semver"},{"version":"6.12.58","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.17.8","status":"unaffected","lessThanOrEqual":"6.17.*","versionType":"semver"},{"version":"6.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/media/common/videobuf2/videobuf2-v4l2.c"]}],"references":["https://git.kernel.org/stable/c/a6a493b985bfffac097a4e1be09f98b27729dca8","https://git.kernel.org/stable/c/e819b34df0a7030a15c968d619fa8a3ed2455c7a","https://git.kernel.org/stable/c/27afd6e066cfd80ddbe22a4a11b99174ac89cced"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/40xxx/CVE-2025-40302.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-40302","state":"PUBLISHED","datePublished":"2025-12-08T00:46:26.293Z","dateUpdated":"2026-10-15T22:02:43.093Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T07:20:57.185Z"},"containers":{"cna":{"title":"media: videobuf2: forbid remove_bufs when legacy fileio is active","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nmedia: videobuf2: forbid remove_bufs when legacy fileio is active\n\nvb2_ioctl_remove_bufs() call manipulates queue internal buffer list,\npotentially overwriting some pointers used by the legacy fileio access\nmode. Forbid that ioctl when fileio is active to protect internal queue\nstate between subsequent read/write calls."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"a3293a85381ec9680aa2929547fbc76c5d87a1b2","status":"affected","lessThan":"a6a493b985bfffac097a4e1be09f98b27729dca8","versionType":"git"},{"version":"a3293a85381ec9680aa2929547fbc76c5d87a1b2","status":"affected","lessThan":"e819b34df0a7030a15c968d619fa8a3ed2455c7a","versionType":"git"},{"version":"a3293a85381ec9680aa2929547fbc76c5d87a1b2","status":"affected","lessThan":"27afd6e066cfd80ddbe22a4a11b99174ac89cced","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/media/common/videobuf2/videobuf2-v4l2.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.10","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.10","versionType":"semver"},{"version":"6.12.58","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.17.8","status":"unaffected","lessThanOrEqual":"6.17.*","versionType":"semver"},{"version":"6.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/media/common/videobuf2/videobuf2-v4l2.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/a6a493b985bfffac097a4e1be09f98b27729dca8"},{"url":"https://git.kernel.org/stable/c/e819b34df0a7030a15c968d619fa8a3ed2455c7a"},{"url":"https://git.kernel.org/stable/c/27afd6e066cfd80ddbe22a4a11b99174ac89cced"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - Exploitation requires opening a V4L2 device node (/dev/videoN) and issuing read()/write() plus the VIDIOC_REMOVE_BUFS ioctl from a local process. There is no network-reachable path into videobuf2's legacy fileio emulator.\nAC:L - The attack is a purely sequential, deterministic three-step sequence on a single file descriptor (read/write → REMOVE_BUFS → read/write) with no race window; the same fd owns the queue so vb2_queue_is_busy() never blocks it. No special memory layout or timing beyond attacker control is required.\nPR:L - Any local unprivileged user with access to the video device node can trigger this — desktop distros grant the active session user access via logind uaccess ACLs/the video group, and Android/embedded camera sandboxes expose these nodes directly. No CAP_SYS_ADMIN or other capability is checked on the ioctl path.\nUI:N - The attacking process performs every step itself on its own file descriptor; no victim action, mount, or plug-in event is needed.\nS:U - The corruption is confined to kernel memory within the same security authority; there is no VM, IOMMU, or sandbox boundary crossed.\nC:H - After the buffers are freed, __vb2_perform_fileio() still does copy_to_user(data, buf->vaddr + buf->pos, count) using the stale cached kernel address, disclosing up to a full frame (potentially megabytes) of freed kernel memory — reusable by kernel stacks, slab objects, or page tables — directly to userspace.\nI:H - On output/write queues the same stale pointer is used in copy_from_user(buf->vaddr + buf->pos, data, count), giving an attacker-controlled write of arbitrary length into freed kernel memory (vfree'd vmalloc region reusable by VMAP kernel stacks, or page-allocator pages with dma-contig), a classic UAF write primitive for privilege escalation; a NULL-pointer write via b->planes[0].bytesused also occurs.\nA:H - vb2_get_buffer() returns NULL for the removed index despite the code asserting it \"can never be NULL when using fileio\", producing a NULL-pointer dereference oops, and the use-after-free of vfree'd vmalloc addresses causes unrecoverable kernel faults."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:09:21.585Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.10","versionEndExcluding":"6.12.58"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.10","versionEndExcluding":"6.17.8"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.10","versionEndExcluding":"6.18"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2025-40302","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2026-10-15T21:58:57.256388Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2026-10-15T22:02:43.093Z"}}]}}}