* [PATCH] erofs: fix order >= MAX_ORDER warning due to crafted nagative i_size [not found] <000000000000ac8efa05e7feaa1f@google.com> @ 2022-09-09 2:39 ` Gao Xiang 2022-09-19 1:37 ` Yue Hu 0 siblings, 1 reply; 2+ messages in thread From: Gao Xiang @ 2022-09-09 2:39 UTC (permalink / raw) To: linux-erofs; +Cc: Gao Xiang, syzbot+f966c13b1b4fc0403b19, syzkaller-bugs, LKML 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") Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> --- fs/erofs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index 95a403720e8c..16cf9a283557 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -214,7 +214,7 @@ static int erofs_fill_symlink(struct inode *inode, void *kaddr, /* if it cannot be handled with fast symlink scheme */ if (vi->datalayout != EROFS_INODE_FLAT_INLINE || - inode->i_size >= EROFS_BLKSIZ) { + inode->i_size >= EROFS_BLKSIZ || inode->i_size < 0) { inode->i_op = &erofs_symlink_iops; return 0; } -- 2.24.4 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] erofs: fix order >= MAX_ORDER warning due to crafted nagative i_size 2022-09-09 2:39 ` [PATCH] erofs: fix order >= MAX_ORDER warning due to crafted nagative i_size Gao Xiang @ 2022-09-19 1:37 ` Yue Hu 0 siblings, 0 replies; 2+ messages in thread From: Yue Hu @ 2022-09-19 1:37 UTC (permalink / raw) To: Gao Xiang; +Cc: syzkaller-bugs, syzbot+f966c13b1b4fc0403b19, linux-erofs, LKML On Fri, 9 Sep 2022 10:39:48 +0800 Gao Xiang <hsiangkao@linux.alibaba.com> wrote: > 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") > Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> > --- > fs/erofs/inode.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c > index 95a403720e8c..16cf9a283557 100644 > --- a/fs/erofs/inode.c > +++ b/fs/erofs/inode.c > @@ -214,7 +214,7 @@ static int erofs_fill_symlink(struct inode *inode, void *kaddr, > > /* if it cannot be handled with fast symlink scheme */ > if (vi->datalayout != EROFS_INODE_FLAT_INLINE || > - inode->i_size >= EROFS_BLKSIZ) { > + inode->i_size >= EROFS_BLKSIZ || inode->i_size < 0) { Reviewed-by: Yue Hu <huyue2@coolpad.com> > inode->i_op = &erofs_symlink_iops; > return 0; > } ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-19 1:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <000000000000ac8efa05e7feaa1f@google.com>
2022-09-09 2:39 ` [PATCH] erofs: fix order >= MAX_ORDER warning due to crafted nagative i_size Gao Xiang
2022-09-19 1:37 ` Yue Hu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox