mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-13 19:50:25 +03:00
QAT: Allocate digest_buffer using QAT_PHYS_CONTIG_ALLOC()
If the buffer 'digest_buffer' is allocated in the qat_checksum() stack, it can't ensure that the address is physically contiguous, and the DMA result of the buffer may be handled incorrectly. Using QAT_PHYS_CONTIG_ALLOC() ensures a physically contiguous allocation. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tom Caputi <tcaputi@datto.com> Signed-off-by: Chengfei, Zhu <chengfeix.zhu@intel.com> Closes #8323 Closes #8521
This commit is contained in:
parent
ec4f9b8f30
commit
45001b949c
@ -455,7 +455,7 @@ qat_checksum(uint64_t cksum, uint8_t *buf, uint64_t size, zio_cksum_t *zcp)
|
||||
Cpa8S *data = NULL;
|
||||
CpaCySymSessionCtx *cy_session_ctx = NULL;
|
||||
cy_callback_t cb;
|
||||
Cpa8U digest_buffer[sizeof (zio_cksum_t)];
|
||||
Cpa8U *digest_buffer = NULL;
|
||||
CpaCySymOpData op_data = { 0 };
|
||||
CpaBufferList src_buffer_list = { 0 };
|
||||
CpaFlatBuffer *flat_src_buf_array = NULL;
|
||||
@ -494,6 +494,10 @@ qat_checksum(uint64_t cksum, uint8_t *buf, uint64_t size, zio_cksum_t *zcp)
|
||||
nr_bufs * sizeof (CpaFlatBuffer));
|
||||
if (status != CPA_STATUS_SUCCESS)
|
||||
goto fail;
|
||||
status = QAT_PHYS_CONTIG_ALLOC(&digest_buffer,
|
||||
sizeof (zio_cksum_t));
|
||||
if (status != CPA_STATUS_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
bytes_left = size;
|
||||
data = buf;
|
||||
@ -530,6 +534,10 @@ qat_checksum(uint64_t cksum, uint8_t *buf, uint64_t size, zio_cksum_t *zcp)
|
||||
status = CPA_STATUS_FAIL;
|
||||
goto fail;
|
||||
}
|
||||
if (cb.verify_result == CPA_FALSE) {
|
||||
status = CPA_STATUS_FAIL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bcopy(digest_buffer, zcp, sizeof (zio_cksum_t));
|
||||
|
||||
@ -541,6 +549,7 @@ fail:
|
||||
kunmap(in_pages[i]);
|
||||
|
||||
cpaCySymRemoveSession(cy_inst_handle, cy_session_ctx);
|
||||
QAT_PHYS_CONTIG_FREE(digest_buffer);
|
||||
QAT_PHYS_CONTIG_FREE(src_buffer_list.pPrivateMetaData);
|
||||
QAT_PHYS_CONTIG_FREE(cy_session_ctx);
|
||||
QAT_PHYS_CONTIG_FREE(flat_src_buf_array);
|
||||
|
Loading…
Reference in New Issue
Block a user