linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Qiujun Huang <anenbupt@gmail.com>
Cc: syzbot <syzbot+4a88b2b9dc280f47baf4@syzkaller.appspotmail.com>,
	aeb@cwi.nl, danarag@gmail.com, kstewart@linuxfoundation.org,
	linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
	tglx@linutronix.de, viro@zeniv.linux.org.uk
Subject: Re: KASAN: null-ptr-deref Write in get_block
Date: Mon, 23 Mar 2020 14:42:25 +0300	[thread overview]
Message-ID: <20200323114225.GE26299@kadam> (raw)
In-Reply-To: <CADG63jAEOBvWZ2G-9tyvHbbuKnHxNTPpqqjfWmhP7YVvsHVioQ@mail.gmail.com>

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@syzkaller.appspotmail.com

> Signed-off-by: Qiujun Huang <hqjagain@gmail.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


  reply	other threads:[~2020-03-23 11:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-21 10:10 KASAN: null-ptr-deref Write in get_block syzbot
2020-03-22 12:06 ` Qiujun Huang
2020-03-23 11:42   ` Dan Carpenter [this message]
2020-03-23 12:18     ` Qiujun Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200323114225.GE26299@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=aeb@cwi.nl \
    --cc=anenbupt@gmail.com \
    --cc=danarag@gmail.com \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+4a88b2b9dc280f47baf4@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).