linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Dan Robertson <dan@dlrobertson.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] fs/btrfs: init csum_list before possible free
Date: Tue, 19 Feb 2019 07:45:15 +0200	[thread overview]
Message-ID: <4f91c93c-72c0-546b-b90e-664129107791@suse.com> (raw)
In-Reply-To: <20190219025643.20382-1-dan@dlrobertson.com>



On 19.02.19 г. 4:56 ч., Dan Robertson wrote:
> The scrub_ctx csum_list member must be initialized before
> scrub_free_ctx is called. If the csum_list is not initialized
> beforehand, the list_empty call in scrub_free_csums will result
> in a null deref.
> 
> Signed-off-by: Dan Robertson <dan@dlrobertson.com>

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

> ---
>  fs/btrfs/scrub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index 6dcd36d7b849..1e08ad1fe2aa 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -584,6 +584,7 @@ static noinline_for_stack struct scrub_ctx *scrub_setup_ctx(
>  	sctx->pages_per_rd_bio = SCRUB_PAGES_PER_RD_BIO;
>  	sctx->curr = -1;
>  	sctx->fs_info = fs_info;
> +	INIT_LIST_HEAD(&sctx->csum_list);
>  	for (i = 0; i < SCRUB_BIOS_PER_SCTX; ++i) {
>  		struct scrub_bio *sbio;
>  
> @@ -608,7 +609,6 @@ static noinline_for_stack struct scrub_ctx *scrub_setup_ctx(
>  	atomic_set(&sctx->workers_pending, 0);
>  	atomic_set(&sctx->cancel_req, 0);
>  	sctx->csum_size = btrfs_super_csum_size(fs_info->super_copy);
> -	INIT_LIST_HEAD(&sctx->csum_list);
>  
>  	spin_lock_init(&sctx->list_lock);
>  	spin_lock_init(&sctx->stat_lock);
> 

  reply	other threads:[~2019-02-19  5:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19  2:56 [PATCH] fs/btrfs: init csum_list before possible free Dan Robertson
2019-02-19  5:45 ` Nikolay Borisov [this message]
2019-02-19 16:31 ` David Sterba
2019-02-21 14:57   ` Dan Robertson
2019-02-22 15:57     ` David Sterba
2019-02-22 16:45       ` Dan Robertson

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=4f91c93c-72c0-546b-b90e-664129107791@suse.com \
    --to=nborisov@suse.com \
    --cc=dan@dlrobertson.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;
as well as URLs for NNTP newsgroup(s).