drm/amdkfd: Avoid integer underflow in EOP ring size calculation.
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:
drm/amdkfd: Avoid integer underflow in EOP ring size calculation.
The low 6 bits of cp_hqd_eop_control store the base-2 logarithm of the EOP ring size. This was calculated as
order_base_2(q->eop_ring_buffer_size / 4) - 1
But order_base_2 can in theory return 0, so this could underflow (although in practice the ring buffer size cannot be less than 4096).
Change this to
order_base_2(q->eop_ring_buffer_size / 8)
using properties of logarithms.
From the CVE record · Linux
The Linux kernel’s AMD KFD driver could theoretically underflow when calculating an EOP ring size. The description says this cannot occur in practice because the ring buffer cannot be smaller than 4096 bytes; it does not identify an attacker capability or access conditions.
Engineers running Linux kernels with the AMD KFD driver should check whether their kernel includes the fix; affected versions are not specified.