public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, Chris Mason <clm@fb.com>,
	Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: Fix incorrect check causing NULL pointer derefernce
Date: Mon, 16 Dec 2019 17:16:39 +0100	[thread overview]
Message-ID: <20191216161639.GD3929@twin.jikos.cz> (raw)
In-Reply-To: <20191215173226.29149-1-pakki001@umn.edu>

On Sun, Dec 15, 2019 at 11:32:26AM -0600, Aditya Pakki wrote:
> In btrfsic_process_superblock, argument state is dereferenced for
> the variable fs_info and then checked for NULL. The patch fixes
> this issue by returning an error if state is NULL and then assigns
> fs_info.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
>  fs/btrfs/check-integrity.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
> index 0b52ab4cb964..70d7a05cafad 100644
> --- a/fs/btrfs/check-integrity.c
> +++ b/fs/btrfs/check-integrity.c
> @@ -629,15 +629,18 @@ static struct btrfsic_dev_state *btrfsic_dev_state_hashtable_lookup(dev_t dev,
>  static int btrfsic_process_superblock(struct btrfsic_state *state,
>  				      struct btrfs_fs_devices *fs_devices)
>  {
> -	struct btrfs_fs_info *fs_info = state->fs_info;
> -	struct btrfs_super_block *selected_super;
> +	struct btrfsic_dev_state *selected_dev_state = NULL;
>  	struct list_head *dev_head = &fs_devices->devices;
> +	struct btrfs_super_block *selected_super;
> +	struct btrfs_fs_info *fs_info;
>  	struct btrfs_device *device;
> -	struct btrfsic_dev_state *selected_dev_state = NULL;
>  	int ret = 0;
>  	int pass;
>  
> -	BUG_ON(NULL == state);

A fix for this has already been merged to our development queue. Thanks.

      parent reply	other threads:[~2019-12-16 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-15 17:32 [PATCH] btrfs: Fix incorrect check causing NULL pointer derefernce Aditya Pakki
2019-12-15 19:56 ` [PATCH] btrfs: Fix incorrect check Markus Elfring
2019-12-16 16:16 ` David Sterba [this message]

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=20191216161639.GD3929@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kjlu@umn.edu \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pakki001@umn.edu \
    /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