{"id":"CVE-2026-139782","state":"PUBLISHED","title":"comedi: addi_apci_3xxx: fix subdevice count underallocation","description":"In the Linux kernel, the following vulnerability has been resolved:\n\ncomedi: addi_apci_3xxx: fix subdevice count underallocation\n\nIn apci3xxx_auto_attach(), the number of subdevices is computed with\n\n    n_subdevices = (board->ai_n_chan ? 0 : 1) + board->has_ao + ...\n\nThe ternary is inverted: when the board has analog input channels\n(ai_n_chan != 0), it counts 0 instead of 1, so the AI subdevice that is\nactually created is not accounted for. As a result\ncomedi_alloc_subdevices() allocates one entry too few, and the later\nsubdevice initialization (notably the TTL Digital I/O subdevice, which\nis populated last) writes past the end of the allocated array, causing a\nslab out-of-bounds write.\n\nFlip the ternary to count 1 when ai_n_chan is non-zero and 0 otherwise,\nmatching the subdevice creation order in the function.","publishedAt":"2026-11-30T13:37:57.259Z","updatedAt":"2026-11-30T13:37:57.259Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"02a58681b48caf417edfdc100d1e7e28c0e66b97","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"2aea3d551ef6b7f1354aab0ccba5d6a189e87e10","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"40c86b6d61895bbbd83c774e362e0d2b6b584728","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"e4a9298361c79fe7c809d61c9a546ddd0cdba566","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"e4ce30e393f264def20791662865d092cd616776","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"6b5f7c695dbbba72b9a5991c084f09454b63bcb8","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"0d903b068e85848347f8641c0e51c45636ee4f60","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"3de5aa458dede472a253266d02902bd95af8e849","versionType":"git"},{"version":"0","status":"affected","lessThan":"5.10.275","versionType":"semver"},{"version":"0","status":"affected","lessThan":"5.15.226","versionType":"semver"},{"version":"0","status":"affected","lessThan":"6.1.193","versionType":"semver"},{"version":"0","status":"affected","lessThan":"6.6.163","versionType":"semver"},{"version":"0","status":"affected","lessThan":"6.12.119","versionType":"semver"},{"version":"0","status":"affected","lessThan":"6.18.65","versionType":"semver"},{"version":"0","status":"affected","lessThan":"7.3.6","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/comedi/drivers/addi_apci_3xxx.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.10.275","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/comedi/drivers/addi_apci_3xxx.c"]}],"references":["https://git.kernel.org/stable/c/02a58681b48caf417edfdc100d1e7e28c0e66b97","https://git.kernel.org/stable/c/2aea3d551ef6b7f1354aab0ccba5d6a189e87e10","https://git.kernel.org/stable/c/40c86b6d61895bbbd83c774e362e0d2b6b584728","https://git.kernel.org/stable/c/e4a9298361c79fe7c809d61c9a546ddd0cdba566","https://git.kernel.org/stable/c/e4ce30e393f264def20791662865d092cd616776","https://git.kernel.org/stable/c/6b5f7c695dbbba72b9a5991c084f09454b63bcb8","https://git.kernel.org/stable/c/0d903b068e85848347f8641c0e51c45636ee4f60","https://git.kernel.org/stable/c/3de5aa458dede472a253266d02902bd95af8e849"],"weaknesses":[],"ingestedAt":"2026-11-30T13:56:04.579Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139782.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139782","state":"PUBLISHED","datePublished":"2026-11-30T13:37:57.259Z","dateUpdated":"2026-11-30T13:37:57.259Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.952Z"},"containers":{"cna":{"title":"comedi: addi_apci_3xxx: fix subdevice count underallocation","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\ncomedi: addi_apci_3xxx: fix subdevice count underallocation\n\nIn apci3xxx_auto_attach(), the number of subdevices is computed with\n\n    n_subdevices = (board->ai_n_chan ? 0 : 1) + board->has_ao + ...\n\nThe ternary is inverted: when the board has analog input channels\n(ai_n_chan != 0), it counts 0 instead of 1, so the AI subdevice that is\nactually created is not accounted for. As a result\ncomedi_alloc_subdevices() allocates one entry too few, and the later\nsubdevice initialization (notably the TTL Digital I/O subdevice, which\nis populated last) writes past the end of the allocated array, causing a\nslab out-of-bounds write.\n\nFlip the ternary to count 1 when ai_n_chan is non-zero and 0 otherwise,\nmatching the subdevice creation order in the function."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"02a58681b48caf417edfdc100d1e7e28c0e66b97","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"2aea3d551ef6b7f1354aab0ccba5d6a189e87e10","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"40c86b6d61895bbbd83c774e362e0d2b6b584728","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"e4a9298361c79fe7c809d61c9a546ddd0cdba566","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"e4ce30e393f264def20791662865d092cd616776","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"6b5f7c695dbbba72b9a5991c084f09454b63bcb8","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"0d903b068e85848347f8641c0e51c45636ee4f60","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"3de5aa458dede472a253266d02902bd95af8e849","versionType":"git"},{"version":"0","status":"affected","lessThan":"5.10.275","versionType":"semver"},{"version":"0","status":"affected","lessThan":"5.15.226","versionType":"semver"},{"version":"0","status":"affected","lessThan":"6.1.193","versionType":"semver"},{"version":"0","status":"affected","lessThan":"6.6.163","versionType":"semver"},{"version":"0","status":"affected","lessThan":"6.12.119","versionType":"semver"},{"version":"0","status":"affected","lessThan":"6.18.65","versionType":"semver"},{"version":"0","status":"affected","lessThan":"7.3.6","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/comedi/drivers/addi_apci_3xxx.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.10.275","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/comedi/drivers/addi_apci_3xxx.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/02a58681b48caf417edfdc100d1e7e28c0e66b97"},{"url":"https://git.kernel.org/stable/c/2aea3d551ef6b7f1354aab0ccba5d6a189e87e10"},{"url":"https://git.kernel.org/stable/c/40c86b6d61895bbbd83c774e362e0d2b6b584728"},{"url":"https://git.kernel.org/stable/c/e4a9298361c79fe7c809d61c9a546ddd0cdba566"},{"url":"https://git.kernel.org/stable/c/e4ce30e393f264def20791662865d092cd616776"},{"url":"https://git.kernel.org/stable/c/6b5f7c695dbbba72b9a5991c084f09454b63bcb8"},{"url":"https://git.kernel.org/stable/c/0d903b068e85848347f8641c0e51c45636ee4f60"},{"url":"https://git.kernel.org/stable/c/3de5aa458dede472a253266d02902bd95af8e849"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:37:57.259Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"5.10.275"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"5.15.226"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.1.193"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.6.163"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.12.119"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}