CVE-2021-46943: media: staging/intel-ipu3: Fix set_fmt error handling
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
media: staging/intel-ipu3: Fix set_fmt error handling
If there in an error during a set_fmt, do not overwrite the previous sizes with the invalid config.
Without this patch, v4l2-compliance ends up allocating 4GiB of RAM and causing the following OOPs
[ 38.662975] ipu3-imgu 0000:00:05.0: swiotlb buffer is full (sz: 4096 bytes) [ 38.662980] DMA: Out of SW-IOMMU space for 4096 bytes at device 0000:00:05.0 [ 38.663010] general protection fault: 0000 [#1] PREEMPT SMP
The Linux kernel CVE team has assigned CVE-2021-46943 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.2 with commit 6d5f26f2e045 and fixed in 5.4.118 with commit a03fb1e8a110 Issue introduced in 5.2 with commit 6d5f26f2e045 and fixed in 5.10.36 with commit c6b81b897f6f Issue introduced in 5.2 with commit 6d5f26f2e045 and fixed in 5.11.20 with commit 34892ea93838 Issue introduced in 5.2 with commit 6d5f26f2e045 and fixed in 5.12.3 with commit 6fb617e37a39 Issue introduced in 5.2 with commit 6d5f26f2e045 and fixed in 5.13 with commit ad91849996f9
Please see https://www.kernel.org or 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-46943
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/staging/media/ipu3/ipu3-v4l2.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/a03fb1e8a110658215a4cefc3e2ad53279e496a6 https://git.kernel.org/stable/c/c6b81b897f6f9445d57f8d47c4e060ec21556137 https://git.kernel.org/stable/c/34892ea938387d83ffcfb7775ec55f0f80767916 https://git.kernel.org/stable/c/6fb617e37a39db0a3eca4489431359d0bdf3b9bc https://git.kernel.org/stable/c/ad91849996f9dd79741a961fd03585a683b08356