CVE-2022-50036: drm/sun4i: dsi: Prevent underflow when computing packet sizes
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
drm/sun4i: dsi: Prevent underflow when computing packet sizes
Currently, the packet overhead is subtracted using unsigned arithmetic. With a short sync pulse, this could underflow and wrap around to near the maximal u16 value. Fix this by using signed subtraction. The call to max() will correctly handle any negative numbers that are produced.
Apply the same fix to the other timings, even though those subtractions are less likely to underflow.
The Linux kernel CVE team has assigned CVE-2022-50036 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.18 with commit 133add5b5ad42b7bb5fcd59d681aef6475d08600 and fixed in 5.10.138 with commit a1e7908f78f5a7f53f8cd83c7dcdfec974c95f26 Issue introduced in 4.18 with commit 133add5b5ad42b7bb5fcd59d681aef6475d08600 and fixed in 5.15.63 with commit 98e28de472ef248352f04f87e29e634ebb0ec240 Issue introduced in 4.18 with commit 133add5b5ad42b7bb5fcd59d681aef6475d08600 and fixed in 5.19.4 with commit fb837f5b83461624e525727a8f4add14b201147e Issue introduced in 4.18 with commit 133add5b5ad42b7bb5fcd59d681aef6475d08600 and fixed in 6.0 with commit 82a1356a933d8443139f8886f11b63c974a09a67
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-2022-50036
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/sun4i/sun6i_mipi_dsi.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/a1e7908f78f5a7f53f8cd83c7dcdfec974c95f26 https://git.kernel.org/stable/c/98e28de472ef248352f04f87e29e634ebb0ec240 https://git.kernel.org/stable/c/fb837f5b83461624e525727a8f4add14b201147e https://git.kernel.org/stable/c/82a1356a933d8443139f8886f11b63c974a09a67