[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADG63jAtF8RidQmeeSw7kC0Vzw2qSEeRYz+HEAKHhLFx7j=Zow@mail.gmail.com>
Date: Mon, 23 Mar 2020 20:18:03 +0800
From: Qiujun Huang <anenbupt@...il.com>
To: Dan Carpenter <dan.carpenter@...cle.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,
Qiujun Huang <hqjagain@...il.com>
Subject: Re: KASAN: null-ptr-deref Write in get_block
On Mon, Mar 23, 2020 at 7:42 PM Dan Carpenter <dan.carpenter@...cle.com> wrote:
>
> 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.
I get it, thanks.
>
> 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