CVE-2022-50313: erofs: fix order >= MAX_ORDER warning due to crafted negative i_size
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
erofs: fix order >= MAX_ORDER warning due to crafted negative i_size
As syzbot reported [1], the root cause is that i_size field is a signed type, and negative i_size is also less than EROFS_BLKSIZ. As a consequence, it's handled as fast symlink unexpectedly.
Let's fall back to the generic path to deal with such unusual i_size.
[1] https://lore.kernel.org/r/[email protected]
The Linux kernel CVE team has assigned CVE-2022-50313 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.19 with commit 431339ba90423a038914c6032bfd71f0ba7ef2f2 and fixed in 5.4.289 with commit 17a0cdbd7b0cf0fc0d7ca4187a67f8f1c18c291f Issue introduced in 4.19 with commit 431339ba90423a038914c6032bfd71f0ba7ef2f2 and fixed in 5.10.233 with commit 0ab621fcdff1a58ff4de51a8590fa92a0ecd34be Issue introduced in 4.19 with commit 431339ba90423a038914c6032bfd71f0ba7ef2f2 and fixed in 5.15.82 with commit acc2f40b980c61a9178b72cdedd150b829064997 Issue introduced in 4.19 with commit 431339ba90423a038914c6032bfd71f0ba7ef2f2 and fixed in 5.19.17 with commit b6c8330f5b0f22149957a2e4977fd0f01a9db7cd Issue introduced in 4.19 with commit 431339ba90423a038914c6032bfd71f0ba7ef2f2 and fixed in 6.0.3 with commit 6235fb899b25fd287d5e42635ff82196395708cc Issue introduced in 4.19 with commit 431339ba90423a038914c6032bfd71f0ba7ef2f2 and fixed in 6.1 with commit 1dd73601a1cba37a0ed5f89a8662c90191df5873
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-50313
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:
fs/erofs/inode.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/17a0cdbd7b0cf0fc0d7ca4187a67f8f1c18c291f https://git.kernel.org/stable/c/0ab621fcdff1a58ff4de51a8590fa92a0ecd34be https://git.kernel.org/stable/c/acc2f40b980c61a9178b72cdedd150b829064997 https://git.kernel.org/stable/c/b6c8330f5b0f22149957a2e4977fd0f01a9db7cd https://git.kernel.org/stable/c/6235fb899b25fd287d5e42635ff82196395708cc https://git.kernel.org/stable/c/1dd73601a1cba37a0ed5f89a8662c90191df5873