Skip to content

Commit

Permalink
block: fix bmd->is_null_mapped initialization
Browse files Browse the repository at this point in the history
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: f325607 ("block: remove the BIO_NULL_MAPPED flag")
Reported-by: Marc Hartmayer <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Sep 23, 2020
1 parent f952eef commit 0385971
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions block/blk-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0385971

Please sign in to comment.