[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK+_RLm93haEd13Z0hVPSRqG4STsDHMHfu4FBdaBW1QP0m_c6w@mail.gmail.com>
Date: Sat, 6 Jan 2024 08:38:02 +0000
From: Tigran Aivazian <aivazian.tigran@...il.com>
To: Xiaochen Zou <xzou017@....edu>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs/bfs: Null check to prevent null-ptr-deref bug
Hello,
On Fri, 5 Jan 2024 at 19:33, Xiaochen Zou <xzou017@....edu> wrote:
> Similar to ea2b62f3058 (fs/sysv: Null check to prevent
> null-ptr-deref bug), bfs is lack of return value check for
> sb_getblk(). Adding a null check to prevent null-ptr-defer bug
> diff --git a/fs/bfs/file.c b/fs/bfs/file.c
> index adc2230079c6..35688424bde3 100644
> --- a/fs/bfs/file.c
> +++ b/fs/bfs/file.c
> @@ -39,6 +39,8 @@ static int bfs_move_block(unsigned long from, unsigned long to,
> if (!bh)
> return -EIO;
> new = sb_getblk(sb, to);
> + if (unlikely(!new))
> + return -ENOMEM;
Thank you, yes, that makes sense. Please apply the patch.
Acknowledged-By; Tigran Aivazian <aivazian.tigran@...il.com>
Powered by blists - more mailing lists