Revert "crypto: qat - reduce size of mapped region"
This reverts commit e48767c177
.
In an attempt to resolve a set of warnings reported by the static
analyzer Smatch, the reverted commit improperly reduced the sizes of the
DMA mappings used for the input and output parameters for both RSA and
DH creating a mismatch (map size=8 bytes, unmap size=64 bytes).
This issue is reported when CONFIG_DMA_API_DEBUG is selected, when the
crypto self test is run. The function dma_unmap_single() reports a
warning similar to the one below, saying that the `device driver frees
DMA memory with different size`.
DMA-API: 4xxx 0000:06:00.0: device driver frees DMA memory with different size [device address=0x0000000123206c80] [map size=8 bytes] [unmap size=64 bytes]
WARNING: CPU: 0 PID: 0 at kernel/dma/debug.c:973 check_unmap+0x3d0/0x8c0\
...
Call Trace:
<IRQ>
debug_dma_unmap_page+0x5c/0x60
qat_dh_cb+0xd7/0x110 [intel_qat]
qat_alg_asym_callback+0x1a/0x30 [intel_qat]
adf_response_handler+0xbd/0x1a0 [intel_qat]
tasklet_action_common.constprop.0+0xcd/0xe0
__do_softirq+0xf8/0x30c
__irq_exit_rcu+0xbf/0x140
common_interrupt+0xb9/0xd0
</IRQ>
<TASK>
The original commit was correct.
Cc: <stable@vger.kernel.org>
Reported-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
cf5bb835b7
commit
9c5f21b198
@ -333,13 +333,13 @@ static int qat_dh_compute_value(struct kpp_request *req)
|
||||
qat_req->out.dh.out_tab[1] = 0;
|
||||
/* Mapping in.in.b or in.in_g2.xa is the same */
|
||||
qat_req->phy_in = dma_map_single(dev, &qat_req->in.dh.in.b,
|
||||
sizeof(qat_req->in.dh.in.b),
|
||||
sizeof(struct qat_dh_input_params),
|
||||
DMA_TO_DEVICE);
|
||||
if (unlikely(dma_mapping_error(dev, qat_req->phy_in)))
|
||||
goto unmap_dst;
|
||||
|
||||
qat_req->phy_out = dma_map_single(dev, &qat_req->out.dh.r,
|
||||
sizeof(qat_req->out.dh.r),
|
||||
sizeof(struct qat_dh_output_params),
|
||||
DMA_TO_DEVICE);
|
||||
if (unlikely(dma_mapping_error(dev, qat_req->phy_out)))
|
||||
goto unmap_in_params;
|
||||
@ -730,13 +730,13 @@ static int qat_rsa_enc(struct akcipher_request *req)
|
||||
qat_req->in.rsa.in_tab[3] = 0;
|
||||
qat_req->out.rsa.out_tab[1] = 0;
|
||||
qat_req->phy_in = dma_map_single(dev, &qat_req->in.rsa.enc.m,
|
||||
sizeof(qat_req->in.rsa.enc.m),
|
||||
sizeof(struct qat_rsa_input_params),
|
||||
DMA_TO_DEVICE);
|
||||
if (unlikely(dma_mapping_error(dev, qat_req->phy_in)))
|
||||
goto unmap_dst;
|
||||
|
||||
qat_req->phy_out = dma_map_single(dev, &qat_req->out.rsa.enc.c,
|
||||
sizeof(qat_req->out.rsa.enc.c),
|
||||
sizeof(struct qat_rsa_output_params),
|
||||
DMA_TO_DEVICE);
|
||||
if (unlikely(dma_mapping_error(dev, qat_req->phy_out)))
|
||||
goto unmap_in_params;
|
||||
@ -876,13 +876,13 @@ static int qat_rsa_dec(struct akcipher_request *req)
|
||||
qat_req->in.rsa.in_tab[3] = 0;
|
||||
qat_req->out.rsa.out_tab[1] = 0;
|
||||
qat_req->phy_in = dma_map_single(dev, &qat_req->in.rsa.dec.c,
|
||||
sizeof(qat_req->in.rsa.dec.c),
|
||||
sizeof(struct qat_rsa_input_params),
|
||||
DMA_TO_DEVICE);
|
||||
if (unlikely(dma_mapping_error(dev, qat_req->phy_in)))
|
||||
goto unmap_dst;
|
||||
|
||||
qat_req->phy_out = dma_map_single(dev, &qat_req->out.rsa.dec.m,
|
||||
sizeof(qat_req->out.rsa.dec.m),
|
||||
sizeof(struct qat_rsa_output_params),
|
||||
DMA_TO_DEVICE);
|
||||
if (unlikely(dma_mapping_error(dev, qat_req->phy_out)))
|
||||
goto unmap_in_params;
|
||||
|
Loading…
Reference in New Issue
Block a user