public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maurizio Lombardi <mlombard@redhat.com>
To: axboe@kernel.dk
Cc: linux-kernel@vger.kernel.org, ming.lei@canonical.com,
	jet.chen@intel.com, akpm@linux-foundation.org,
	Valdis.Kletnieks@vt.edu
Subject: Re: [PATCH] bio: merge_bvec_fn() must be called with the old bi_iter.bi_size value
Date: Mon, 11 Aug 2014 16:13:54 +0200	[thread overview]
Message-ID: <53E8CFA2.60408@redhat.com> (raw)
In-Reply-To: <1405586950-4023-1-git-send-email-mlombard@redhat.com>

Hi Jens,

On 07/17/2014 10:49 AM, Maurizio Lombardi wrote:
> The patch "bio: modify __bio_add_page() to accept pages that
> don't start a new segment" updates bio->bi_iter.bi_size before
> calling merge_bvec_fn().
> 
> This panics the kernel because merge_bvec_fn() expects bi_size to have
> the old value.
> 
> This can be reproduced by trying to create a crypto device with cryptsetup.

Can we give to this patch "bio: modify __bio_add_page() to accept pages that don't start a new segment"
another chance to get in?

Should I squash it with the following fix and resubmit as a single patch or it's not necessary?

> 
> Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
> Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
> ---
>  block/bio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/bio.c b/block/bio.c
> index fb12df9..40c5b12 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -795,7 +795,7 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
>  		struct bvec_merge_data bvm = {
>  			.bi_bdev = bio->bi_bdev,
>  			.bi_sector = bio->bi_iter.bi_sector,
> -			.bi_size = bio->bi_iter.bi_size,
> +			.bi_size = bio->bi_iter.bi_size - len,
>  			.bi_rw = bio->bi_rw,
>  		};
>  
> 

Thanks,
Maurizio Lombardi

      reply	other threads:[~2014-08-11 14:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17  8:49 [PATCH] bio: merge_bvec_fn() must be called with the old bi_iter.bi_size value Maurizio Lombardi
2014-08-11 14:13 ` Maurizio Lombardi [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=53E8CFA2.60408@redhat.com \
    --to=mlombard@redhat.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=jet.chen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@canonical.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