Linux bcache driver list
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Zheng Wang <zyytlz.wz@163.com>
Cc: colyli@suse.de, hackerzheng666@gmail.com,
	kent.overstreet@gmail.com, linux-bcache@vger.kernel.org,
	linux-kernel@vger.kernel.org, security@kernel.org,
	alex000young@gmail.com
Subject: Re: [PATCH] bcache: Fix a NULL or wild pointer dereference in btree_split
Date: Thu, 2 Feb 2023 13:08:51 +0100	[thread overview]
Message-ID: <Y9un0/BnBoe4B4m1@kroah.com> (raw)
In-Reply-To: <20230202110543.27548-1-zyytlz.wz@163.com>

On Thu, Feb 02, 2023 at 07:05:43PM +0800, Zheng Wang wrote:
> In btree_split, btree_node_alloc_replacement() is assigned to
> n1 and return error code or NULL on failure. n1->c->cache is
> passed to block_bytes. So there is a dereference of it
>  without checks, which may lead to wild pointer dereference or
>   NULL pointer dereference depending on n1. The initial code only
>   judge the error code but igore the NULL pointer.
> So does n2 and n3.
> 
> Fix this bug by adding IS_ERR_OR_NULL check of n1, n2 and n3.
> 
> Note that, as a bug found by static analysis, it can be a false
> positive or hard to trigger.
> 
> Fixes: cafe56359144 ("bcache: A block layer cache")
> Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
> ---
>  drivers/md/bcache/btree.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Note, there is no need to cc: security@k.o on any of these patches that
you send to public mailing lists, as the development and discussion of
them should happen there instead.

thanks,

greg k-h

  reply	other threads:[~2023-02-02 12:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 11:05 [PATCH] bcache: Fix a NULL or wild pointer dereference in btree_split Zheng Wang
2023-02-02 12:08 ` Greg KH [this message]
2023-02-02 13:58   ` Zheng Hacker
2023-02-02 12:21 ` Coly Li
2023-02-02 14:11   ` Zheng Hacker
2023-02-02 14:18     ` Coly Li
2023-02-02 14:21       ` Zheng Hacker

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=Y9un0/BnBoe4B4m1@kroah.com \
    --to=greg@kroah.com \
    --cc=alex000young@gmail.com \
    --cc=colyli@suse.de \
    --cc=hackerzheng666@gmail.com \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=security@kernel.org \
    --cc=zyytlz.wz@163.com \
    /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