net: enetc: fix potential divide-by-zero when num_vsi is zero
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
net: enetc: fix potential divide-by-zero when num_vsi is zero
For i.MX94 series, all the standalone ENETCs do not support SR-IOV, so pf->caps.num_vsi is zero. This leads to a divide-by-zero in enetc4_default_rings_allocation() when distributing rings among PF and VFs.
Division by zero is undefined behavior in C. On ARM64, the UDIV/SDIV instructions silently return zero rather than raising an exception, so the issue does not cause a visible crash. However, relying on this behavior is incorrect and poses a cross-platform compatibility risk.
Add an explicit check for num_vsi == 0 and return early after the PF's rings have been configured.
From the CVE record · Linux
On i.MX94 systems, standalone ENETCs have no SR-IOV support, leaving num_vsi at zero and causing a divide-by-zero during ring allocation. The input describes no attacker path, authentication requirement, or user interaction; on ARM64, the division silently returns zero rather than causing a visible crash.
Engineers running the Linux kernel on i.MX94 systems with standalone ENETCs should check their kernel versions; affected versions are not specified.