CVE-2026-99485: accel/amdxdna: clear the mailbox channel pointer when starting it fails
In the Linux kernel, the following vulnerability has been resolved:
accel/amdxdna: clear the mailbox channel pointer when starting it fails
aie2createcontext() allocates a mailbox channel, starts it, and on a failed start frees it again:
hwctx->priv->mboxchann = xdnamailboxallocchannel(ndev->mbox); ... ret = xdnamailboxstartchannel(hwctx->priv->mboxchann, ...); if (ret) goto freechannel; ... freechannel: xdnamailboxfreechannel(hwctx->priv->mboxchann);
hwctx->priv->mboxchann keeps pointing at the freed channel. That pointer is the driver's own test for whether a hardware context has a usable channel: aie2destroycontext() returns early on NULL, aie2schedjobrun() refuses to run a job on NULL, and the message helpers return -ENODEV on NULL. A stale pointer passes all of them.
It matters on the restart path. aie2hwctxrestart() calls aie2createcontext() again on a hardware context that is already live, after aie2hwctxstop() has torn its channel down, and the context survives a failure there: aie2schedjobtimedout() discards the return value entirely, and aie2hwctxresume() only propagates it. What is left is a live hardware context holding a freed channel, and every later user of it takes the non-NULL branch:
- the next job submitted reaches xdnamailboxsendmsg() on the freed channel, via the !mboxchann guard in aie2schedjobrun(), - a second command timeout reaches aie2hwctxstop() -> aie2destroycontext(), - closing the device reaches aie2hwctxfini() -> aie2releaseresource() -> xrsreleaseresource() -> aie2xrsunload() -> aie2destroycontext(),
and aie2destroycontext() then calls xdnamailboxstopchannel() followed by xdnamailboxfreechannel() on memory that was already freed: a use-after-free, and a second free of the same channel.
The AIE4 management channel already does this correctly - aie4mailboxstart() clears ndev->aie.mgmtchann right after freeing it. Do the same here.
The create path itself is not affected: when aie2xrsload() fails, xrsallocateresource() removes the solver node without calling ->unload, and aie2hwctxinit() frees hwctx->priv, so the stale pointer never outlives the structure holding it.
Starting a channel can fail today without this patch: the ring buffer sizes firmware reports are rejected unless both are powers of two, and requestirq() can fail.
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In accel/amdxdna, clear hwctx->priv->mbox_chann when xdna_mailbox_start_channel() fails, after freeing the channel.