# CVE-2026-139782: comedi: addi_apci_3xxx: fix subdevice count underallocation

- Severity: not scored yet
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.34%, higher than 30% of CVEs (2026-12-01)
- Published: 2026-11-30T13:37:57.259Z
- Modified: 2026-11-30T14:20:11.500Z
- Assigned by: Linux

## Description

In the Linux kernel, the following vulnerability has been resolved:

comedi: addi_apci_3xxx: fix subdevice count underallocation

In apci3xxx_auto_attach(), the number of subdevices is computed with

    n_subdevices = (board->ai_n_chan ? 0 : 1) + board->has_ao + ...

The ternary is inverted: when the board has analog input channels
(ai_n_chan != 0), it counts 0 instead of 1, so the AI subdevice that is
actually created is not accounted for. As a result
comedi_alloc_subdevices() allocates one entry too few, and the later
subdevice initialization (notably the TTL Digital I/O subdevice, which
is populated last) writes past the end of the allocated array, causing a
slab out-of-bounds write.

Flip the ternary to count 1 when ai_n_chan is non-zero and 0 otherwise,
matching the subdevice creation order in the function.

(As written by CVE List.)

## Affected

- Linux Linux: from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 before 02a58681b48caf417edfdc100d1e7e28c0e66b97; from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 before 2aea3d551ef6b7f1354aab0ccba5d6a189e87e10; from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 before 40c86b6d61895bbbd83c774e362e0d2b6b584728; from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 before e4a9298361c79fe7c809d61c9a546ddd0cdba566; from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 before e4ce30e393f264def20791662865d092cd616776; from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 before 6b5f7c695dbbba72b9a5991c084f09454b63bcb8; from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 before 0d903b068e85848347f8641c0e51c45636ee4f60; from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 before 3de5aa458dede472a253266d02902bd95af8e849; before 5.10.275; before 5.15.226; before 6.1.193; before 6.6.163; and 3 more (not affected: from 5.10.275 up to 5.10.*; from 5.15.226 up to 5.15.*; from 6.1.193 up to 6.1.*; from 6.6.163 up to 6.6.*; from 6.12.119 up to 6.12.*; from 6.18.65 up to 6.18.*; from 7.3.6 up to 7.3.*; from 7.4-rc1 up to *)

## 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>

## Sources

- CVE List: [CVE-2026-139782](https://www.cve.org/CVERecord?id=CVE-2026-139782), CVE Terms of Use, modified 2026-11-30
- NVD: [CVE-2026-139782](https://nvd.nist.gov/vuln/detail/CVE-2026-139782), Public domain, modified 2026-11-30

---

Page: https://cve.day/CVE-2026-139782 · Whole record: https://cve.day/CVE-2026-139782.json · Rebuilt by cve.day 2026-11-30T14:33:42.654Z
