mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-14 21:29:37 +02:00
crypto: caam - Pad SG length when allocating hash edesc
[ Upstream commit5124bc9616
] Because hardware will read in multiples of 4 SG entries, ensure the allocated length is always padded. This was already done by some callers of ahash_edesc_alloc, but ahash_digest was conspicuously missing. In any case, doing it in the allocation function ensures that the memory is always there. Reported-by: Guangwu Zhang <guazhang@redhat.com> Fixes:a5e5c13398
("crypto: caam - fix S/G table passing page boundary") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
318f70857c
commit
21b4fa3bff
|
@ -708,6 +708,7 @@ static struct ahash_edesc *ahash_edesc_alloc(struct ahash_request *req,
|
||||||
GFP_KERNEL : GFP_ATOMIC;
|
GFP_KERNEL : GFP_ATOMIC;
|
||||||
struct ahash_edesc *edesc;
|
struct ahash_edesc *edesc;
|
||||||
|
|
||||||
|
sg_num = pad_sg_nents(sg_num);
|
||||||
edesc = kzalloc(struct_size(edesc, sec4_sg, sg_num), flags);
|
edesc = kzalloc(struct_size(edesc, sec4_sg, sg_num), flags);
|
||||||
if (!edesc)
|
if (!edesc)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user