Skip to content

Commit 0385971

Browse files
Christoph Hellwigaxboe
Christoph Hellwig
authored andcommitted
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: 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]>
1 parent f952eef commit 0385971

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

block/blk-map.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ static int bio_copy_user_iov(struct request *rq, struct rq_map_data *map_data,
148148
* shortlived one.
149149
*/
150150
bmd->is_our_pages = !map_data;
151+
bmd->is_null_mapped = (map_data && map_data->null_mapped);
151152

152153
nr_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
153154
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,
218219
}
219220

220221
bio->bi_private = bmd;
221-
if (map_data && map_data->null_mapped)
222-
bmd->is_null_mapped = true;
223222

224223
bounce_bio = bio;
225224
ret = blk_rq_append_bio(rq, &bounce_bio);

0 commit comments

Comments
 (0)