android_kernel_sony_sdm845/drivers/crypto
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Horia Geantă 99f1f6b309 crypto: caam - fix concurrency issue in givencrypt descriptor
commit 48f89d2a2920166c35b1c0b69917dbb0390ebec7 upstream.

IV transfer from ofifo to class2 (set up at [29][30]) is not guaranteed
to be scheduled before the data transfer from ofifo to external memory
(set up at [38]:

[29] 10FA0004           ld: ind-nfifo (len=4) imm
[30] 81F00010               <nfifo_entry: ofifo->class2 type=msg len=16>
[31] 14820004           ld: ccb2-datasz len=4 offs=0 imm
[32] 00000010               data:0x00000010
[33] 8210010D    operation: cls1-op aes cbc init-final enc
[34] A8080B04         math: (seqin + math0)->vseqout len=4
[35] 28000010    seqfifold: skip len=16
[36] A8080A04         math: (seqin + math0)->vseqin len=4
[37] 2F1E0000    seqfifold: both msg1->2-last2-last1 len=vseqinsz
[38] 69300000   seqfifostr: msg len=vseqoutsz
[39] 5C20000C      seqstr: ccb2 ctx len=12 offs=0

If ofifo -> external memory transfer happens first, DECO will hang
(issuing a Watchdog Timeout error, if WDOG is enabled) waiting for
data availability in ofifo for the ofifo -> c2 ififo transfer.

Make sure IV transfer happens first by waiting for all CAAM internal
transfers to end before starting payload transfer.

New descriptor with jump command inserted at [37]:

[..]
[36] A8080A04         math: (seqin + math0)->vseqin len=4
[37] A1000401         jump: jsl1 all-match[!nfifopend] offset=[01] local->[38]
[38] 2F1E0000    seqfifold: both msg1->2-last2-last1 len=vseqinsz
[39] 69300000   seqfifostr: msg len=vseqoutsz
[40] 5C20000C      seqstr: ccb2 ctx len=12 offs=0

[Note: the issue is present in the descriptor from the very beginning
(cf. Fixes tag). However I've marked it v4.19+ since it's the oldest
maintained kernel that the patch applies clean against.]

Cc: <stable@vger.kernel.org> # v4.19+
Fixes: 1acebad3d8 ("crypto: caam - faster aead implementation")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[Horia: backport to v4.4, v4.9]
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-17 13:42:19 -07:00
..
amcc crypto: crypto4xx - fix a potential double free in ppc4xx_trng_probe 2019-08-04 09:33:26 +02:00
caam crypto: caam - fix concurrency issue in givencrypt descriptor 2019-10-17 13:42:19 -07:00
ccp crypto: ccp - Validate the the error value used to index error messages 2019-08-04 09:33:30 +02:00
chelsio crypto: chcr - Check device is allocated before use 2017-02-14 15:25:32 -08:00
marvell crypto: marvell - Copy IVDIG before launching partial DMA ahash requests 2017-11-30 08:39:14 +00:00
nx crypto: nx - off by one bug in nx_of_update_msc() 2016-07-19 12:01:47 +08:00
qat crypto: qat - Silence smp_processor_id() warning 2019-10-17 13:42:05 -07:00
qce crypto: qce - Use skcipher for fallback 2016-07-01 23:45:09 +08:00
rockchip crypto: rockchip - use devm_add_action_or_reset() 2016-08-24 21:07:11 +08:00
sunxi-ss crypto: sun4i-ss - Fix invalid calculation of hash end 2019-05-31 06:48:16 -07:00
ux500 crypto: ux500 - Use proper enum in hash_set_dma_transfer 2019-02-12 19:44:58 +01:00
vmx crypto: vmx - ghash: do nosimd fallback manually 2019-06-11 12:22:35 +02:00
atmel-aes-regs.h crypto: atmel-aes - add support to GCM mode 2015-12-23 18:19:58 +08:00
atmel-aes.c Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2016-03-17 11:22:54 -07:00
atmel-sha-regs.h crypto: atmel-sha - fix context switches 2016-01-25 22:42:07 +08:00
atmel-sha.c crypto: atmel - only treat EBUSY as transient if backlog 2017-07-21 07:42:23 +02:00
atmel-tdes-regs.h
atmel-tdes.c crypto: atmel - fix checks of error code returned by devm_ioremap_resource() 2016-03-11 21:19:19 +08:00
bfin_crc.c crypto: hash - annotate algorithms taking optional key 2018-02-25 11:05:43 +01:00
bfin_crc.h
geode-aes.c
geode-aes.h
hifn_795x.c crypto: squash lines for simple wrapper functions 2016-09-13 20:27:26 +08:00
img-hash.c crypto: img-hash - Fix set_reqsize call 2016-08-09 18:47:23 +08:00
ixp4xx_crypto.c crypto: ixp4xx - Fix error handling path in 'aead_perform()' 2017-08-24 17:12:18 -07:00
Kconfig Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2016-10-10 14:04:16 -07:00
Makefile crypto: Added Chelsio Menu to the Kconfig file 2016-08-19 00:00:37 -07:00
mv_cesa.c crypto: mv_cesa - remove NO_IRQ reference 2016-09-07 21:08:32 +08:00
mv_cesa.h
mxc-scc.c crypto: mxc-scc - check clk_prepare_enable() error 2016-08-24 21:04:50 +08:00
mxs-dcp.c crypto: mxs-dcp - Fix wait logic on chan threads 2018-10-10 08:53:23 +02:00
n2_asm.S
n2_core.c crypto: n2 - cure use after free 2018-01-10 09:29:51 +01:00
n2_core.h
omap-aes.c crypto: omap-aes - fix error return code in omap_aes_probe() 2016-09-22 18:27:35 +08:00
omap-des.c crypto: omap-des - fix error return code in omap_des_probe() 2016-09-22 18:27:34 +08:00
omap-sham.c crypto: omap-sham - fix memleak 2018-06-16 09:52:35 +02:00
padlock-aes.c crypto: padlock-aes - Fix Nano workaround data corruption 2018-08-06 16:23:04 +02:00
padlock-sha.c x86/cpufeature: Remove unused and seldomly used cpu_has_xx macros 2015-12-19 11:49:55 +01:00
picoxcell_crypto.c crypto: picoxcell - Use skcipher for fallback 2016-07-01 23:45:09 +08:00
picoxcell_crypto_regs.h
s5p-sss.c crypto: s5p-sss - Fix kernel Oops in AES-ECB mode 2018-02-25 11:05:56 +01:00
sahara.c crypto: sharah - Unregister correct algorithms for SAHARA 3 2018-09-26 08:36:34 +02:00
talitos.c crypto: talitos - fix missing break in switch statement 2019-10-05 12:30:07 +02:00
talitos.h crypto: talitos - add new crypto modes 2015-12-04 22:29:56 +08:00