net: mana: Fix TOCTOU double-fetch of hwc_msg_id from DMA buffer
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ ca9c54d2d6a5ab2430c4eda364c77125d62e5e0f · < 3c4db56ccd13dd020fbf43afabaee74a40ec75e4| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
net: mana: Fix TOCTOU double-fetch of hwc_msg_id from DMA buffer
In mana_hwc_rx_event_handler(), resp->response.hwc_msg_id is read from DMA-coherent memory and bounds-checked, then mana_hwc_handle_resp() re-reads the same field from the same DMA buffer for test_bit() and pointer arithmetic.
DMA-coherent memory is mapped uncacheable on x86 and is shared, unencrypted, in Confidential VMs (SEV-SNP/TDX), so each load goes directly to host-visible memory. A H/W can modify the value between the check and the use, bypassing the bounds validation.
Fix this by reading hwc_msg_id exactly once using READ_ONCE() into a stack-local variable in mana_hwc_rx_event_handler(), and passing the validated value as a parameter to mana_hwc_handle_resp().
From the CVE record · Linux
The mana network driver checks a message ID in a DMA buffer, then reads it again when handling a response. Hardware able to change the buffer between those reads can bypass the bounds check, including in Confidential VMs where the buffer is shared with the host. The input does not specify a network attack path, authentication requirement, or user interaction.
Engineers running Linux kernels with the mana network driver should check whether their kernel is affected; affected versions were not provided.