CVE-2026-19184: Out-of-bounds write in the NXP GAU ADC driver due to byte-versus-sample buffer size validation mismatch
The NXP GAU ADC driver (drivers/adc/adcmcuxgauadc.c) validated the caller-supplied sequence->buffersize, which is expressed in bytes, against the number of active channels, which is a sample count. It then stored that byte count directly in data->resultslength and used it in mcuxgauadcreadsamples() as the number of uint16t slots available. Because each conversion result occupies sizeof(uint16t) bytes, a buffer that was accepted as "large enough" could be written with up to twice its size in bytes, so every sample past the buffer's midpoint was written out of bounds.
adcread() and adcreadasync() are Zephyr system calls. The syscall verifier in drivers/adc/adchandlers.c only confirms that the caller owns buffersize writable bytes (KSYSCALLMEMORYWRITE); deciding whether that size is sufficient for the requested channels and extrasamplings is delegated entirely to the driver. On a build with CONFIGUSERSPACE=y, a user-mode thread that has been granted the ADC device object could therefore submit a deliberately half-sized buffer and cause the driver's work-queue handler — which runs in supervisor mode, outside the caller's MPU restrictions — to write ADC conversion results past the end of that buffer, at an address and for a length of the caller's choosing.
The overrun is bounded by the requested sequence: with sequence->options->extrasamplings set, the sampling loop walks the buffer pointer forward across every sampling, so the total overrun can reach the full size of the supplied buffer (kilobytes for a large extrasamplings). The written words are 16-bit ADC conversion results, so the content is only partially attacker-influenced (via the selected analog input, gain and resolution), but the destination and length are fully controlled — sufficient for kernel memory corruption, a crash, or a userspace-to-kernel privilege escalation. Builds without CONFIGUSERSPACE, or on SoCs other than NXP RW61x with the GAU ADC node enabled, are not exposed to the privilege boundary; there the same defect only causes a silent overflow when the application itself passes an undersized buffer.
The fix replaces the ad-hoc check with the shared adcsequencevalidatebuffer() helper (validating against numchannels sizeof(uint16t)), stores buffersize / sizeof(uint16t) in resultslength, and corrects the loop bound to a post-decrement so exactly the available number of slots may be written.
Affected Software
Event History
Frequently Asked Questions
Who is realistically exposed to exploitation?
The described privilege-boundary impact applies to builds with CONFIG_USERSPACE=y where a user-mode thread has been granted access to the ADC device object. The vulnerable driver’s work-queue handler performs the write in supervisor mode, outside the caller’s MPU restrictions.
What does an attacker need to trigger the out-of-bounds write?
An attacker needs the ability to invoke adc_read() or adc_read_async() from a user-mode thread with access to the ADC device. They can provide a buffer sized to pass the syscall writable-memory check but only about half the size needed for the requested conversion results.
Does the syscall memory validation prevent this issue?
No. The syscall verifier checks only that the caller owns buffer_size writable bytes; it does not verify that the buffer is large enough for the requested channels and extra samplings. Buffer-size sufficiency is delegated to the driver.