提交 8af7b0f8 编写于 作者: V Victoria Milhoan 提交者: Herbert Xu

crypto: caam - Fix incorrect size when DMA unmapping buffer

The CAAM driver uses two data buffers to store data for a hashing operation,
with one buffer defined as active. This change forces switching of the
active buffer when executing a hashing operation to avoid a later DMA unmap
using the length of the opposite buffer.
Signed-off-by: NVictoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 d37e2969
...@@ -835,17 +835,17 @@ static int ahash_update_ctx(struct ahash_request *req) ...@@ -835,17 +835,17 @@ static int ahash_update_ctx(struct ahash_request *req)
src_map_to_sec4_sg(jrdev, req->src, src_nents, src_map_to_sec4_sg(jrdev, req->src, src_nents,
edesc->sec4_sg + sec4_sg_src_index, edesc->sec4_sg + sec4_sg_src_index,
chained); chained);
if (*next_buflen) { if (*next_buflen)
scatterwalk_map_and_copy(next_buf, req->src, scatterwalk_map_and_copy(next_buf, req->src,
to_hash - *buflen, to_hash - *buflen,
*next_buflen, 0); *next_buflen, 0);
state->current_buf = !state->current_buf;
}
} else { } else {
(edesc->sec4_sg + sec4_sg_src_index - 1)->len |= (edesc->sec4_sg + sec4_sg_src_index - 1)->len |=
SEC4_SG_LEN_FIN; SEC4_SG_LEN_FIN;
} }
state->current_buf = !state->current_buf;
sh_len = desc_len(sh_desc); sh_len = desc_len(sh_desc);
desc = edesc->hw_desc; desc = edesc->hw_desc;
init_job_desc_shared(desc, ptr, sh_len, HDR_SHARE_DEFER | init_job_desc_shared(desc, ptr, sh_len, HDR_SHARE_DEFER |
...@@ -1268,9 +1268,10 @@ static int ahash_update_no_ctx(struct ahash_request *req) ...@@ -1268,9 +1268,10 @@ static int ahash_update_no_ctx(struct ahash_request *req)
scatterwalk_map_and_copy(next_buf, req->src, scatterwalk_map_and_copy(next_buf, req->src,
to_hash - *buflen, to_hash - *buflen,
*next_buflen, 0); *next_buflen, 0);
state->current_buf = !state->current_buf;
} }
state->current_buf = !state->current_buf;
sh_len = desc_len(sh_desc); sh_len = desc_len(sh_desc);
desc = edesc->hw_desc; desc = edesc->hw_desc;
init_job_desc_shared(desc, ptr, sh_len, HDR_SHARE_DEFER | init_job_desc_shared(desc, ptr, sh_len, HDR_SHARE_DEFER |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册