diff options
author | Christoph Hellwig <hch@lst.de> | 2020-09-23 18:07:13 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-09-23 18:18:39 +0300 |
commit | 0385971754f0aa0507ecd7f0a0f4a48781906eda (patch) | |
tree | f75049f052338e26a4d1520fa8d031f7815dce07 | |
parent | f952eefe74a4083142b4cdf0626ebbc07378aeb5 (diff) | |
download | linux-0385971754f0aa0507ecd7f0a0f4a48781906eda.tar.xz |
block: fix bmd->is_null_mapped initialization
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>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | block/blk-map.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/block/blk-map.c b/block/blk-map.c index be118926ccf4..21630dccac62 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); |