On Thu, Jun 23, 2022 at 09:49:56AM +0000, cge...@gm... wrote:
> From: xu xin <xu....@zt...>
>
> As the bug description at
> https://lore.kernel.org/lkml/202...@zt.../
> 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: st...@vg...
> Reported-by: Zeal Robot <ze...@zt...>
> Reported-by: syz...@sy...
> Reviewed-by: Songyi Zhang <zha...@zt...>
> Reviewed-by: Yang Yang <yan...@zt...>
> Reviewed-by: Jiang Xuexin<jia...@zt...>
> Reviewed-by: Zhang wenya<zha...@zt...>
> Signed-off-by: xu xin <xu....@zt...>
> ---
>
> Change for v2:
> - Use ntfs_warning instead of WARN().
> - Add the tag Cc: st...@vg....
> ---
> 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
|