]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
crypto: caam/jr - fix ablkcipher_edesc pointer arithmetic
authorHoria Geantă <horia.geanta@nxp.com>
Fri, 14 Sep 2018 15:34:28 +0000 (18:34 +0300)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:52:32 +0000 (19:52 -0600)
commit84cc0320dbd49b14cd4e61f56e3789b0ce58ab9f
tree8b32e2eb31b00534bf0ddb0590d068f19ee5363b
parent1fa309eab800d0ecc2be5e7cf5afcb2e72447398
crypto: caam/jr - fix ablkcipher_edesc pointer arithmetic

BugLink: https://bugs.launchpad.net/bugs/1836426
commit 13cc6f48c7434ce46ba6dbc90003a136a263d75a upstream.

In some cases the zero-length hw_desc array at the end of
ablkcipher_edesc struct requires for 4B of tail padding.

Due to tail padding and the way pointers to S/G table and IV
are computed:
edesc->sec4_sg = (void *)edesc + sizeof(struct ablkcipher_edesc) +
 desc_bytes;
iv = (u8 *)edesc->hw_desc + desc_bytes + sec4_sg_bytes;
first 4 bytes of IV are overwritten by S/G table.

Update computation of pointer to S/G table to rely on offset of hw_desc
member and not on sizeof() operator.

Cc: <stable@vger.kernel.org> # 4.13+
Fixes: 115957bb3e59 ("crypto: caam - fix IV DMA mapping and updating")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/crypto/caam/caamalg.c