All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Prince Kumar Maurya <princekumarmaurya06@gmail.com>
Cc: brauner@kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org,
	syzkaller-bugs@googlegroups.com, linux-kernel@vger.kernel.org,
	viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
	chenzhongjin@huawei.com
Subject: Re: [PATCH] Null check to prevent null-ptr-deref bug
Date: Sun, 28 May 2023 17:46:39 +0100	[thread overview]
Message-ID: <2023052822-mauve-gauging-0ab3@gregkh> (raw)
In-Reply-To: <20230528164400.592092-1-princekumarmaurya06@gmail.com>

On Sun, May 28, 2023 at 09:44:00AM -0700, Prince Kumar Maurya wrote:
> sb_getblk(inode->i_sb, parent) return a null ptr and taking lock on that leads to the null-ptr-deref bug.
> 
> Signed-off-by: Prince Kumar Maurya <princekumarmaurya06@gmail.com>
> ---
>  fs/sysv/itree.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
> index b22764fe669c..3a6b66e719fd 100644
> --- a/fs/sysv/itree.c
> +++ b/fs/sysv/itree.c
> @@ -145,6 +145,8 @@ static int alloc_branch(struct inode *inode,
>  		 */
>  		parent = block_to_cpu(SYSV_SB(inode->i_sb), branch[n-1].key);
>  		bh = sb_getblk(inode->i_sb, parent);
> +		if (!bh)
> +			break;
>  		lock_buffer(bh);
>  		memset(bh->b_data, 0, blocksize);
>  		branch[n].bh = bh;
> -- 
> 2.40.1

Why resend this when I already responded:
	https://lore.kernel.org/r/2023052803-pucker-depress-5452@gregkh

confused,

greg k-h
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <gregkh@linuxfoundation.org>
To: Prince Kumar Maurya <princekumarmaurya06@gmail.com>
Cc: skhan@linuxfoundation.org, viro@zeniv.linux.org.uk,
	brauner@kernel.org, chenzhongjin@huawei.com,
	syzkaller-bugs@googlegroups.com,
	linux-kernel-mentees@lists.linuxfoundation.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Null check to prevent null-ptr-deref bug
Date: Sun, 28 May 2023 17:46:39 +0100	[thread overview]
Message-ID: <2023052822-mauve-gauging-0ab3@gregkh> (raw)
In-Reply-To: <20230528164400.592092-1-princekumarmaurya06@gmail.com>

On Sun, May 28, 2023 at 09:44:00AM -0700, Prince Kumar Maurya wrote:
> sb_getblk(inode->i_sb, parent) return a null ptr and taking lock on that leads to the null-ptr-deref bug.
> 
> Signed-off-by: Prince Kumar Maurya <princekumarmaurya06@gmail.com>
> ---
>  fs/sysv/itree.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
> index b22764fe669c..3a6b66e719fd 100644
> --- a/fs/sysv/itree.c
> +++ b/fs/sysv/itree.c
> @@ -145,6 +145,8 @@ static int alloc_branch(struct inode *inode,
>  		 */
>  		parent = block_to_cpu(SYSV_SB(inode->i_sb), branch[n-1].key);
>  		bh = sb_getblk(inode->i_sb, parent);
> +		if (!bh)
> +			break;
>  		lock_buffer(bh);
>  		memset(bh->b_data, 0, blocksize);
>  		branch[n].bh = bh;
> -- 
> 2.40.1

Why resend this when I already responded:
	https://lore.kernel.org/r/2023052803-pucker-depress-5452@gregkh

confused,

greg k-h

  reply	other threads:[~2023-05-28 16:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 22:36 [syzbot] [fs?] KASAN: null-ptr-deref Write in get_block (2) syzbot
2023-05-28  1:25 ` [PATCH] Null check to prevent null-ptr-deref bug Prince Kumar Maurya
2023-05-28  1:25   ` Prince Kumar Maurya
2023-05-28  6:58   ` Greg KH
2023-05-28  6:58     ` Greg KH
2023-05-28 16:44 ` Prince Kumar Maurya
2023-05-28 16:44   ` Prince Kumar Maurya
2023-05-28 16:46   ` Greg KH [this message]
2023-05-28 16:46     ` Greg KH
2023-05-28 17:35 ` Prince Kumar Maurya
2023-05-28 17:35   ` Prince Kumar Maurya
2023-05-28 17:51   ` Greg KH
2023-05-28 17:51     ` Greg KH
2023-05-28 17:52   ` Greg KH
2023-05-28 17:52     ` Greg KH
2023-05-28 18:44 ` [PATCH v3] fs/sysv: " Prince Kumar Maurya
2023-05-28 18:44   ` Prince Kumar Maurya
2023-05-30  8:26   ` Christian Brauner
2023-05-30  8:26     ` Christian Brauner
2023-05-30 14:59     ` Prince Kumar Maurya
2023-05-30 14:59       ` Prince Kumar Maurya
2023-05-30 15:54       ` Christian Brauner
2023-05-30 15:54         ` Christian Brauner
2023-05-31  1:31         ` [PATCH v4] " Prince Kumar Maurya
2023-05-31  1:31           ` Prince Kumar Maurya
2023-06-01  7:55   ` Christian Brauner
2023-06-01  7:55     ` Christian Brauner

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=2023052822-mauve-gauging-0ab3@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=brauner@kernel.org \
    --cc=chenzhongjin@huawei.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=princekumarmaurya06@gmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.