{"id":"CVE-2025-39684","state":"PUBLISHED","title":"comedi: Fix use of uninitialized memory in do_insn_ioctl() and do_insnlist_ioctl()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\ncomedi: Fix use of uninitialized memory in do_insn_ioctl() and do_insnlist_ioctl()\n\nsyzbot reports a KMSAN kernel-infoleak in `do_insn_ioctl()`.  A kernel\nbuffer is allocated to hold `insn->n` samples (each of which is an\n`unsigned int`).  For some instruction types, `insn->n` samples are\ncopied back to user-space, unless an error code is being returned.  The\nproblem is that not all the instruction handlers that need to return\ndata to userspace fill in the whole `insn->n` samples, so that there is\nan information leak.  There is a similar syzbot report for\n`do_insnlist_ioctl()`, although it does not have a reproducer for it at\nthe time of writing.\n\nOne culprit is `insn_rw_emulate_bits()` which is used as the handler for\n`INSN_READ` or `INSN_WRITE` instructions for subdevices that do not have\na specific handler for that instruction, but do have an `INSN_BITS`\nhandler.  For `INSN_READ` it only fills in at most 1 sample, so if\n`insn->n` is greater than 1, the remaining `insn->n - 1` samples copied\nto userspace will be uninitialized kernel data.\n\nAnother culprit is `vm80xx_ai_insn_read()` in the \"vm80xx\" driver.  It\nnever returns an error, even if it fails to fill the buffer.\n\nFix it in `do_insn_ioctl()` and `do_insnlist_ioctl()` by making sure\nthat uninitialized parts of the allocated buffer are zeroed before\nhandling each instruction.\n\nThanks to Arnaud Lecomte for their fix to `do_insn_ioctl()`.  That fix\nreplaced the call to `kmalloc_array()` with `kcalloc()`, but it is not\nalways necessary to clear the whole buffer.","publishedAt":"2025-09-05T17:20:50.827Z","updatedAt":"2026-05-12T12:06:11.333Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"ed9eccbe8970f6eedc1b978c157caf1251a896d4","status":"affected","lessThan":"868a1b68dcd9f2805bb86aa64862402f785d8c4a","versionType":"git"},{"version":"ed9eccbe8970f6eedc1b978c157caf1251a896d4","status":"affected","lessThan":"ff4a7c18799c7fe999fa56c5cf276e13866b8c1a","versionType":"git"},{"version":"ed9eccbe8970f6eedc1b978c157caf1251a896d4","status":"affected","lessThan":"d84f6e77ebe3359394df32ecd97e0d76a25283dc","versionType":"git"},{"version":"ed9eccbe8970f6eedc1b978c157caf1251a896d4","status":"affected","lessThan":"f3b0c9ec54736f3b8118f93a473d22e11ee65743","versionType":"git"},{"version":"ed9eccbe8970f6eedc1b978c157caf1251a896d4","status":"affected","lessThan":"aecf0d557ddd95ce68193a5ee1dc4c87415ff08a","versionType":"git"},{"version":"ed9eccbe8970f6eedc1b978c157caf1251a896d4","status":"affected","lessThan":"3cd212e895ca2d58963fdc6422502b10dd3966bb","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/comedi/comedi_fops.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.29","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.29","versionType":"semver"},{"version":"5.15.190","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.149","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.103","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.44","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.16.4","status":"unaffected","lessThanOrEqual":"6.16.*","versionType":"semver"},{"version":"6.17","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/comedi/comedi_fops.c"]}],"references":["https://git.kernel.org/stable/c/868a1b68dcd9f2805bb86aa64862402f785d8c4a","https://git.kernel.org/stable/c/ff4a7c18799c7fe999fa56c5cf276e13866b8c1a","https://git.kernel.org/stable/c/d84f6e77ebe3359394df32ecd97e0d76a25283dc","https://git.kernel.org/stable/c/f3b0c9ec54736f3b8118f93a473d22e11ee65743","https://git.kernel.org/stable/c/aecf0d557ddd95ce68193a5ee1dc4c87415ff08a","https://git.kernel.org/stable/c/3cd212e895ca2d58963fdc6422502b10dd3966bb","https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html","https://cert-portal.siemens.com/productcert/html/ssa-032379.html"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/39xxx/CVE-2025-39684.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-39684","state":"PUBLISHED","datePublished":"2025-09-05T17:20:50.827Z","dateUpdated":"2026-05-12T12:06:11.333Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T07:20:57.113Z"},"containers":{"cna":{"title":"comedi: Fix use of uninitialized memory in do_insn_ioctl() and do_insnlist_ioctl()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\ncomedi: Fix use of uninitialized memory in do_insn_ioctl() and do_insnlist_ioctl()\n\nsyzbot reports a KMSAN kernel-infoleak in `do_insn_ioctl()`.  A kernel\nbuffer is allocated to hold `insn->n` samples (each of which is an\n`unsigned int`).  For some instruction types, `insn->n` samples are\ncopied back to user-space, unless an error code is being returned.  The\nproblem is that not all the instruction handlers that need to return\ndata to userspace fill in the whole `insn->n` samples, so that there is\nan information leak.  There is a similar syzbot report for\n`do_insnlist_ioctl()`, although it does not have a reproducer for it at\nthe time of writing.\n\nOne culprit is `insn_rw_emulate_bits()` which is used as the handler for\n`INSN_READ` or `INSN_WRITE` instructions for subdevices that do not have\na specific handler for that instruction, but do have an `INSN_BITS`\nhandler.  For `INSN_READ` it only fills in at most 1 sample, so if\n`insn->n` is greater than 1, the remaining `insn->n - 1` samples copied\nto userspace will be uninitialized kernel data.\n\nAnother culprit is `vm80xx_ai_insn_read()` in the \"vm80xx\" driver.  It\nnever returns an error, even if it fails to fill the buffer.\n\nFix it in `do_insn_ioctl()` and `do_insnlist_ioctl()` by making sure\nthat uninitialized parts of the allocated buffer are zeroed before\nhandling each instruction.\n\nThanks to Arnaud Lecomte for their fix to `do_insn_ioctl()`.  That fix\nreplaced the call to `kmalloc_array()` with `kcalloc()`, but it is not\nalways necessary to clear the whole buffer."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"ed9eccbe8970f6eedc1b978c157caf1251a896d4","status":"affected","lessThan":"868a1b68dcd9f2805bb86aa64862402f785d8c4a","versionType":"git"},{"version":"ed9eccbe8970f6eedc1b978c157caf1251a896d4","status":"affected","lessThan":"ff4a7c18799c7fe999fa56c5cf276e13866b8c1a","versionType":"git"},{"version":"ed9eccbe8970f6eedc1b978c157caf1251a896d4","status":"affected","lessThan":"d84f6e77ebe3359394df32ecd97e0d76a25283dc","versionType":"git"},{"version":"ed9eccbe8970f6eedc1b978c157caf1251a896d4","status":"affected","lessThan":"f3b0c9ec54736f3b8118f93a473d22e11ee65743","versionType":"git"},{"version":"ed9eccbe8970f6eedc1b978c157caf1251a896d4","status":"affected","lessThan":"aecf0d557ddd95ce68193a5ee1dc4c87415ff08a","versionType":"git"},{"version":"ed9eccbe8970f6eedc1b978c157caf1251a896d4","status":"affected","lessThan":"3cd212e895ca2d58963fdc6422502b10dd3966bb","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/comedi/comedi_fops.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.29","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.29","versionType":"semver"},{"version":"5.15.190","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.149","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.103","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.44","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.16.4","status":"unaffected","lessThanOrEqual":"6.16.*","versionType":"semver"},{"version":"6.17","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/comedi/comedi_fops.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/868a1b68dcd9f2805bb86aa64862402f785d8c4a"},{"url":"https://git.kernel.org/stable/c/ff4a7c18799c7fe999fa56c5cf276e13866b8c1a"},{"url":"https://git.kernel.org/stable/c/d84f6e77ebe3359394df32ecd97e0d76a25283dc"},{"url":"https://git.kernel.org/stable/c/f3b0c9ec54736f3b8118f93a473d22e11ee65743"},{"url":"https://git.kernel.org/stable/c/aecf0d557ddd95ce68193a5ee1dc4c87415ff08a"},{"url":"https://git.kernel.org/stable/c/3cd212e895ca2d58963fdc6422502b10dd3966bb"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-05-11T21:34:15.439Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.29","versionEndExcluding":"5.15.190"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.29","versionEndExcluding":"6.1.149"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.29","versionEndExcluding":"6.6.103"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.29","versionEndExcluding":"6.12.44"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.29","versionEndExcluding":"6.16.4"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.29","versionEndExcluding":"6.17"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CVE Program Container","references":[{"url":"https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html"}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2025-11-03T17:42:16.502Z"}},{"affected":[{"vendor":"Siemens","product":"SIMATIC CN 4100","defaultStatus":"unknown","versions":[{"version":"0","status":"affected","lessThan":"V5.0","versionType":"custom"}]}],"references":[{"url":"https://cert-portal.siemens.com/productcert/html/ssa-032379.html"}],"providerMetadata":{"shortName":"siemens-SADP","orgId":"0b142b55-0307-4c5a-b3c9-f314f3fb7c5e","dateUpdated":"2026-05-12T12:06:11.333Z"},"x_adpType":"supplier"}]}}}