linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Hartmayer <mhartmay@linux.ibm.com>
To: Christoph Hellwig <hch@lst.de>, axboe@kernel.dk
Cc: mhartmay@linux.ibm.com, linux-block@vger.kernel.org
Subject: Re: [PATCH] block: fix bmd->is_null_mapped initialization
Date: Wed, 23 Sep 2020 18:34:11 +0200	[thread overview]
Message-ID: <87r1qs8nb0.fsf@linux.ibm.com> (raw)
In-Reply-To: <20200923150713.416286-1-hch@lst.de>

On Wed, Sep 23, 2020 at 05:07 PM +0200, Christoph Hellwig <hch@lst.de> wrote:
> bmd is allocated using kmalloc in bio_alloc_map_data, so make sure
> is_null_mapped is properly initialized to false for the !null_mapped
> case.
>
> Fixes: f3256075ba49 ("block: remove the BIO_NULL_MAPPED flag")
> Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/blk-map.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/block/blk-map.c b/block/blk-map.c
> index be118926ccf4e3..21630dccac628c 100644
> --- a/block/blk-map.c
> +++ b/block/blk-map.c
> @@ -148,6 +148,7 @@ static int bio_copy_user_iov(struct request *rq, struct rq_map_data *map_data,
>  	 * shortlived one.
>  	 */
>  	bmd->is_our_pages = !map_data;
> +	bmd->is_null_mapped = (map_data && map_data->null_mapped);
>  
>  	nr_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
>  	if (nr_pages > BIO_MAX_PAGES)
> @@ -218,8 +219,6 @@ static int bio_copy_user_iov(struct request *rq, struct rq_map_data *map_data,
>  	}
>  
>  	bio->bi_private = bmd;
> -	if (map_data && map_data->null_mapped)
> -		bmd->is_null_mapped = true;
>  
>  	bounce_bio = bio;
>  	ret = blk_rq_append_bio(rq, &bounce_bio);
> -- 
> 2.28.0

Tested-by: Marc Hartmayer <mhartmay@linux.ibm.com>

      parent reply	other threads:[~2020-09-23 16:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 15:07 [PATCH] block: fix bmd->is_null_mapped initialization Christoph Hellwig
2020-09-23 15:19 ` Jens Axboe
2020-09-23 16:34 ` Marc Hartmayer [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=87r1qs8nb0.fsf@linux.ibm.com \
    --to=mhartmay@linux.ibm.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@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).