[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200323114225.GE26299@kadam>
Date: Mon, 23 Mar 2020 14:42:25 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Qiujun Huang <anenbupt@...il.com>
Cc: syzbot <syzbot+4a88b2b9dc280f47baf4@...kaller.appspotmail.com>,
aeb@....nl, danarag@...il.com, kstewart@...uxfoundation.org,
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com,
tglx@...utronix.de, viro@...iv.linux.org.uk
Subject: Re: KASAN: null-ptr-deref Write in get_block
Fix the subject to [PATCH] minix: Fix NULL dereference in alloc_branch()
On Sun, Mar 22, 2020 at 08:06:48PM +0800, Qiujun Huang wrote:
> Need to check the return value of sb_getblk.
>
Add a Reported-by tag.
Reported-by: syzbot+4a88b2b9dc280f47baf4@...kaller.appspotmail.com
> Signed-off-by: Qiujun Huang <hqjagain@...il.com>
> ---
> fs/minix/itree_common.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/minix/itree_common.c b/fs/minix/itree_common.c
> index 043c3fd..eedd79f 100644
> --- a/fs/minix/itree_common.c
> +++ b/fs/minix/itree_common.c
> @@ -85,6 +85,8 @@ static int alloc_branch(struct inode *inode,
> break;
> branch[n].key = cpu_to_block(nr);
> bh = sb_getblk(inode->i_sb, parent);
> + if (!bh)
> + break;
The patch is white space damaged and we need to do a bit of error
handling before the break as well.
bh = sb_getblk(inode->i_sb, parent);
+ if (!bh) {
+ minix_free_block(inode, block_to_cpu(branch[n].key));
+ break;
+ }
lock_buffer(bh);
Please fix those few things and resend.
regards,
dan carpenter
Powered by blists - more mailing lists