CVE-2026-86092: Use-after-free in the I2S configure system call when a dynamically allocated memory slab is retained by the driver
The user-mode verifier for the I2S configure system call, zvrfyi2sconfigure() in drivers/i2s/i2shandlers.c, validated the caller-supplied struct kmemslab with KSYSCALLOBJ(). That is a point-in-time check: it confirms the object type, that the object is initialized, and that the calling thread holds permission on it, but it places no hold on the object's lifetime. The validated pointer is then copied into the driver's per-direction stream state (for example drvdata->rx.cfg.memslab in drivers/i2s/i2snrfx.c) and is dereferenced long after the system call returns.
The lifetime of a kernel object allocated with kobjectalloc() is driven solely by its permission bitmask; a pointer retained by the kernel is not represented there. A user thread that holds the last permission on such a slab can free it at any time after the check, either by calling kobjectrelease() or simply by terminating, at which point unrefcheck() in kernel/userspace/userspace.c releases both the object metadata and the struct kmemslab storage back to the kernel heap. The subsequent i2sbufwrite(), i2sbufread(), or driver DMA/ISR completion then calls kmemslaballoc() / kmemslabfree() through the stale pointer.
The result is a supervisor-mode use-after-free reachable from an unprivileged user thread: the freed block is read and written (freelist, wait queue, info.numused) after the attacker can have caused it to be reused by an unrelated kernel object, which undermines the isolation that CONFIGUSERSPACE is meant to provide. Exploitation requires CONFIGUSERSPACE together with CONFIGDYNAMICOBJECTS, and an application that hands a dynamically allocated, initialized memory slab to a user thread that becomes its last permission holder — kmemslabinit() is not itself a system call, so a user thread cannot create such a slab unaided. Builds that use only statically declared slabs (KMEMSLABDEFINE) are unaffected.
The fix replaces the check with KSYSCALLOBJSTATIC(), which additionally rejects objects carrying KOBJFLAGALLOC, so only slabs that can never be freed reach the driver.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In z_vrfy_i2s_configure() in drivers/i2s/i2s_handlers.c, replace K_SYSCALL_OBJ() with K_SYSCALL_OBJ_STATIC() to reject dynamically allocated slabs.
Event History
Frequently Asked Questions
Who is exposed to this issue?
Systems that allow user-mode callers to invoke the I2S configure system call with a dynamically allocated k_mem_slab are exposed. The affected path retains the caller-supplied slab pointer in driver stream state after system-call validation returns.
What does an attacker need to do to trigger the stale pointer condition?
The caller must hold permission on a dynamically allocated memory slab and be able to remove its final permission after configuring I2S. This can be done with k_object_release() or by terminating the thread, causing the slab object and its storage to be returned to the kernel heap.
When is the freed slab accessed?
The retained pointer can be dereferenced later during i2s_buf_write(), i2s_buf_read(), or driver DMA/ISR completion, when the driver calls k_mem_slab_alloc() or k_mem_slab_free() through the stale pointer.