]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
erofs: fix order >= MAX_ORDER warning due to crafted negative i_size
authorGao Xiang <hsiangkao@linux.alibaba.com>
Wed, 18 Dec 2024 07:36:25 +0000 (15:36 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2025 12:24:51 +0000 (13:24 +0100)
commit0ab621fcdff1a58ff4de51a8590fa92a0ecd34be
tree85502ddab0268f958fa4816a8f7150812ecf7c4a
parent0f851f8c62d0a842a18ac745534fa360b16c1c6f
erofs: fix order >= MAX_ORDER warning due to crafted negative i_size

commit 1dd73601a1cba37a0ed5f89a8662c90191df5873 upstream.

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/000000000000ac8efa05e7feaa1f@google.com

Reported-by: syzbot+f966c13b1b4fc0403b19@syzkaller.appspotmail.com
Fixes: 431339ba9042 ("staging: erofs: add inode operations")
Reviewed-by: Yue Hu <huyue2@coolpad.com>
Link: https://lore.kernel.org/r/20220909023948.28925-1-hsiangkao@linux.alibaba.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/erofs/inode.c