[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YrSeAGmk4GZndtdn@sol.localdomain>
Date: Thu, 23 Jun 2022 10:08:16 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: cgel.zte@...il.com
Cc: anton@...era.com, linux-ntfs-dev@...ts.sourceforge.net,
stable@...r.kernel.org, linux-kernel@...r.kernel.org,
xu.xin16@....com.cn, linux-fsdevel@...r.kernel.org,
Zeal Robot <zealci@....com.cn>,
syzbot+6a5a7672f663cce8b156@...kaller.appspotmail.com,
Songyi Zhang <zhang.songyi@....com.cn>,
Yang Yang <yang.yang29@....com.cn>,
Jiang Xuexin <jiang.xuexin@....com.cn>,
Zhang wenya <zhang.wenya1@....com.cn>
Subject: Re: [PATCH v2] fs/ntfs: fix BUG_ON of ntfs_read_block()
On Thu, Jun 23, 2022 at 09:49:56AM +0000, cgel.zte@...il.com wrote:
> From: xu xin <xu.xin16@....com.cn>
>
> As the bug description at
> https://lore.kernel.org/lkml/20220623033635.973929-1-xu.xin16@zte.com.cn/
> attckers can use this bug to crash the system.
>
> So to avoid panic, remove the BUG_ON, and use ntfs_warning to output a
> warning to the syslog and return instead until someone really solve
> the problem.
>
> Cc: stable@...r.kernel.org
> Reported-by: Zeal Robot <zealci@....com.cn>
> Reported-by: syzbot+6a5a7672f663cce8b156@...kaller.appspotmail.com
> Reviewed-by: Songyi Zhang <zhang.songyi@....com.cn>
> Reviewed-by: Yang Yang <yang.yang29@....com.cn>
> Reviewed-by: Jiang Xuexin<jiang.xuexin@....com.cn>
> Reviewed-by: Zhang wenya<zhang.wenya1@....com.cn>
> Signed-off-by: xu xin <xu.xin16@....com.cn>
> ---
>
> Change for v2:
> - Use ntfs_warning instead of WARN().
> - Add the tag Cc: stable@...r.kernel.org.
> ---
> fs/ntfs/aops.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
> index 5f4fb6ca6f2e..84d68efb4ace 100644
> --- a/fs/ntfs/aops.c
> +++ b/fs/ntfs/aops.c
> @@ -183,7 +183,12 @@ static int ntfs_read_block(struct page *page)
> vol = ni->vol;
>
> /* $MFT/$DATA must have its complete runlist in memory at all times. */
> - BUG_ON(!ni->runlist.rl && !ni->mft_no && !NInoAttr(ni));
> + if (unlikely(!ni->runlist.rl && !ni->mft_no && !NInoAttr(ni))) {
> + ntfs_warning(vi->i_sb, "Error because ni->runlist.rl, ni->mft_no, "
> + "and NInoAttr(ni) is null.");
> + unlock_page(page);
> + return -EINVAL;
> + }
A better warning message that doesn't rely on implementation details (struct
field and macro names) would be "Runlist of $MFT/$DATA is not cached". Also,
why does this situation happen in the first place? Is there a way to prevent
this situation in the first place?
- Eric
Powered by blists - more mailing lists