CVE-2021-4460: drm/amdkfd: Fix UBSAN shift-out-of-bounds warning
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
drm/amdkfd: Fix UBSAN shift-out-of-bounds warning
If get_num_sdma_queues or get_num_xgmi_sdma_queues is 0, we end up doing a shift operation where the number of bits shifted equals number of bits in the operand. This behaviour is undefined.
Set num_sdma_queues or num_xgmi_sdma_queues to ULLONG_MAX, if the count is >= number of bits in the operand.
The Linux kernel CVE team has assigned CVE-2021-4460 to this issue.
Affected and fixed versions
===========================
Fixed in 5.4.118 with commit 0c0356ef2498c1a250fe3846f30293f828737309 Fixed in 5.10.36 with commit 1874b0ef1426b873de94c61861e38f29a8df714c Fixed in 5.11.20 with commit 3fdc5182700910a685d23df57d65166e8556a266 Fixed in 5.12.3 with commit 9069b1b542de8f3bbffef868aff41521b21485cf Fixed in 5.13 with commit 50e2fc36e72d4ad672032ebf646cecb48656efe0
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2021-4460
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/0c0356ef2498c1a250fe3846f30293f828737309 https://git.kernel.org/stable/c/1874b0ef1426b873de94c61861e38f29a8df714c https://git.kernel.org/stable/c/3fdc5182700910a685d23df57d65166e8556a266 https://git.kernel.org/stable/c/9069b1b542de8f3bbffef868aff41521b21485cf https://git.kernel.org/stable/c/50e2fc36e72d4ad672032ebf646cecb48656efe0