CVE-2022-49645: drm/panfrost: Fix shrinker list corruption by madvise IOCTL
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
drm/panfrost: Fix shrinker list corruption by madvise IOCTL
Calling madvise IOCTL twice on BO causes memory shrinker list corruption and crashes kernel because BO is already on the list and it's added to the list again, while BO should be removed from the list before it's re-added. Fix it.
The Linux kernel CVE team has assigned CVE-2022-49645 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.4 with commit 013b6510131568ce4e01856d5360bfdfe9c3632f and fixed in 5.4.207 with commit 393594aad55179eb761af41533d8d1d6eb4543b0 Issue introduced in 5.4 with commit 013b6510131568ce4e01856d5360bfdfe9c3632f and fixed in 5.10.132 with commit 0581613df7f9a4c5fac096ce1d5fb15b7b994240 Issue introduced in 5.4 with commit 013b6510131568ce4e01856d5360bfdfe9c3632f and fixed in 5.15.56 with commit 1807d8867402a58b831a7fc16832747ff559a0d1 Issue introduced in 5.4 with commit 013b6510131568ce4e01856d5360bfdfe9c3632f and fixed in 5.18.13 with commit f036392edd9c49090781d8cca26ad6557a63bae4 Issue introduced in 5.4 with commit 013b6510131568ce4e01856d5360bfdfe9c3632f and fixed in 5.19 with commit 9fc33eaaa979d112d10fea729edcd2a2e21aa912
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-49645
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/panfrost/panfrost_drv.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/393594aad55179eb761af41533d8d1d6eb4543b0 https://git.kernel.org/stable/c/0581613df7f9a4c5fac096ce1d5fb15b7b994240 https://git.kernel.org/stable/c/1807d8867402a58b831a7fc16832747ff559a0d1 https://git.kernel.org/stable/c/f036392edd9c49090781d8cca26ad6557a63bae4 https://git.kernel.org/stable/c/9fc33eaaa979d112d10fea729edcd2a2e21aa912