Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Boleyn Su <boleynsu@google.com>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>, Boleyn Su <boleyn.su@gmail.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: backref: this patch fixes a null pointer dereference bug.
Date: Thu, 6 Aug 2020 09:45:09 +0300	[thread overview]
Message-ID: <353cd2ae-93a7-cd0a-9fce-fa4478f07cc9@suse.com> (raw)
In-Reply-To: <20200806063144.2119712-1-boleynsu@google.com>



On 6.08.20 г. 9:31 ч., Boleyn Su wrote:
> The `if (!ret)` check will always be false and it may result in ret->path
> being dereferenced while it is a null pointer.
> 
> Fixes: a37f232b7b65 ("btrfs: backref: introduce the skeleton of btrfs_backref_iter")
> Cc: Chris Mason <clm@fb.com>
> Cc: Josef Bacik <josef@toxicpanda.com>
> Cc: David Sterba <dsterba@suse.com>
> Cc: Boleyn Su <boleyn.su@gmail.com>
> Cc: linux-btrfs@vger.kernel.org> Signed-off-by: Boleyn Su <boleynsu@google.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  fs/btrfs/backref.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
> index ea10f7bc9..ea1c28ccb 100644
> --- a/fs/btrfs/backref.c
> +++ b/fs/btrfs/backref.c
> @@ -2303,7 +2303,7 @@ struct btrfs_backref_iter *btrfs_backref_iter_alloc(
>  		return NULL;
>  
>  	ret->path = btrfs_alloc_path();
> -	if (!ret) {
> +	if (!ret->path) {
>  		kfree(ret);
>  		return NULL;
>  	}
> 

  reply	other threads:[~2020-08-06 11:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06  6:31 [PATCH] btrfs: backref: this patch fixes a null pointer dereference bug Boleyn Su
2020-08-06  6:45 ` Nikolay Borisov [this message]
2020-08-06  7:03 ` Qu Wenruo
     [not found]   ` <CAJkxivDhyn9ZbNyhKgs1KcTjzz_2UFMVKDi0SLkvb=O3iZ4rZA@mail.gmail.com>
2020-08-07  5:40     ` Qu Wenruo

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=353cd2ae-93a7-cd0a-9fce-fa4478f07cc9@suse.com \
    --to=nborisov@suse.com \
    --cc=boleyn.su@gmail.com \
    --cc=boleynsu@google.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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