mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Wu Bo <bo.wu@vivo.com>
Cc: Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
	Wu Bo <wubo.oduw@gmail.com>, Eric Biggers <ebiggers@kernel.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 1/2] dm verity: init fec io before cleaning it
Date: Wed, 29 Nov 2023 18:20:46 +0100 (CET)	[thread overview]
Message-ID: <64cbcac5-6ad-945d-32e9-87497c3615a6@redhat.com> (raw)
In-Reply-To: <4257e74602bd0ea192011eaefdbf8a2205382b56.1700623691.git.bo.wu@vivo.com>



On Tue, 21 Nov 2023, Wu Bo wrote:

> If BIO error, it may goto verity_finish_io() before
> verity_fec_init_io(). Therefor, the fec_io->rs is not initialized and
> may crash when doing memory freeing in verity_fec_finish_io().
> 
> Crash call stack:
>  die+0x90/0x2b8
>  __do_kernel_fault+0x260/0x298
>  do_bad_area+0x2c/0xdc
>  do_translation_fault+0x3c/0x54
>  do_mem_abort+0x54/0x118
>  el1_abort+0x38/0x5c
>  el1h_64_sync_handler+0x50/0x90
>  el1h_64_sync+0x64/0x6c
>  free_rs+0x18/0xac
>  fec_rs_free+0x10/0x24
>  mempool_free+0x58/0x148
>  verity_fec_finish_io+0x4c/0xb0
>  verity_end_io+0xb8/0x150
> 
> Cc: stable@vger.kernel.org      # v6.0+
> Fixes: 5721d4e5a9cd ("dm verity: Add optional "try_verify_in_tasklet" feature")
> Signed-off-by: Wu Bo <bo.wu@vivo.com>
> ---
>  drivers/md/dm-verity-target.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index e115fcfe723c..beec14b6b044 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -642,7 +642,6 @@ static void verity_work(struct work_struct *w)
>  
>  	io->in_tasklet = false;
>  
> -	verity_fec_init_io(io);
>  	verity_finish_io(io, errno_to_blk_status(verity_verify_io(io)));
>  }
>  
> @@ -792,6 +791,8 @@ static int verity_map(struct dm_target *ti, struct bio *bio)
>  	bio->bi_private = io;
>  	io->iter = bio->bi_iter;
>  
> +	verity_fec_init_io(io);
> +
>  	verity_submit_prefetch(v, io);
>  
>  	submit_bio_noacct(bio);
> -- 
> 2.25.1

Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>


  reply	other threads:[~2023-11-29 17:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22  3:51 [PATCH v2 0/2] dm verity: fix FEC stuck during lower dm suspend Wu Bo
2023-11-22  3:51 ` [PATCH v2 1/2] dm verity: init fec io before cleaning it Wu Bo
2023-11-29 17:20   ` Mikulas Patocka [this message]
2023-11-22  3:51 ` [PATCH v2 2/2] dm verity: don't verity if readahead failed Wu Bo
2023-11-28 12:40   ` Wu Bo
2023-11-29 17:26   ` Mikulas Patocka

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=64cbcac5-6ad-945d-32e9-87497c3615a6@redhat.com \
    --to=mpatocka@redhat.com \
    --cc=agk@redhat.com \
    --cc=bo.wu@vivo.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=ebiggers@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=snitzer@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=wubo.oduw@gmail.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

all inboxes | Powered by JetHome®