Commit 7c88f7cf authored by Hou Tao's avatar Hou Tao Committed by Mikulas Patocka
Browse files

dm-crypt: fully initialize clone->bi_iter in crypt_alloc_buffer()



Both kcryptd_io_read() and kcryptd_crypt_write_convert() will invoke
crypt_alloc_buffer() to allocate a new bio. Both of these two callers
initialize bi_iter.bi_sector for the new bio separatedly after
crypt_alloc_buffer() returns. However, kcryptd_crypt_write_convert()
will copy the bi_iter of the new bio into ctx.iter_out or ctx.iter_in.
Although it doesn't incur any harm now, it is better to fully initialize
bi_iter before it is used.

Therefore, initialize bi_iter.bi_sector in crypt_alloc_buffer() instead.

Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
parent 6fd2cb38
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment