forcedeth: fix off-by-one when saving/restoring non-PCI config space
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 1a1ca86158eee303af5270338695f90bc7ae02b3 · < 0c3f4544ff3873594c8af1b907b4ac4e6d5ce005| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
forcedeth: fix off-by-one when saving/restoring non-PCI config space
nv_suspend() and nv_resume() walk the non-PCI configuration space with
for (i = 0; i <= np->register_size/sizeof(u32); i++)
which runs one iteration too many. saved_config_space is declared as
u32 saved_config_space[NV_PCI_REGSZ_MAX/4];
and NV_PCI_REGSZ_VER3 is equal to NV_PCI_REGSZ_MAX (0x604), so on a VER3 device register_size/sizeof(u32) is exactly the array length and the last iteration addresses one element past the end.
The element it lands on is np->name_rx[0..3]: saved_config_space[] is followed immediately by char name_rx[IFNAMSIZ + 3], and char needs no padding. Nothing observable is corrupted by that, because nv_request_irq() rewrites name_rx with sprintf() before it is ever passed to request_irq(). The bug is the out-of-bounds access itself, which UBSAN reports and which CONFIG_UBSAN_TRAP=y turns into a trap that aborts the running kernel code, plus an MMIO read and, on resume, an MMIO writel() to base + 0x604, one dword past the range the driver mapped:
From the CVE record · Linux
The Linux kernel’s forcedeth driver accesses memory outside an array and performs an MMIO read or write past its mapped range during suspend and resume. With CONFIG_UBSAN_TRAP enabled, the out-of-bounds access can trap and abort running kernel code. The input does not establish an attacker path, authentication requirement, or user-interaction requirement.
Engineers running Linux kernels with the forcedeth driver should check their kernel versions against the vendor advisory; affected versions are not specified.