android_kernel_oneplus_msm8998/drivers/crypto/caam
Horia Geantă 7b66838321 crypto: caam - fix endless loop when DECO acquire fails
commit 225ece3e7dad4cfc44cca38ce7a3a80f255ea8f1 upstream.

In case DECO0 cannot be acquired - i.e. run_descriptor_deco0() fails
with -ENODEV, caam_probe() enters an endless loop:

run_descriptor_deco0
	ret -ENODEV
	-> instantiate_rng
		-ENODEV, overwritten by -EAGAIN
		ret -EAGAIN
		-> caam_probe
			-EAGAIN results in endless loop

It turns out the error path in instantiate_rng() is incorrect,
the checks are done in the wrong order.

Fixes: 1005bccd7a ("crypto: caam - enable instantiation of all RNG4 state handles")
Reported-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Suggested-by: Auer Lukas <lukas.auer@aisec.fraunhofer.de>
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>
2018-02-16 20:09:45 +01:00
..
caamalg.c crypto: caam - fix AEAD givenc descriptors 2017-01-06 11:16:12 +01:00
caamhash.c crypto: caam - fix signals handling 2017-07-21 07:44:59 +02:00
caamrng.c
compat.h
ctrl.c crypto: caam - fix endless loop when DECO acquire fails 2018-02-16 20:09:45 +01:00
ctrl.h
desc.h
desc_constr.h
error.c
error.h
intern.h
jr.c crypto: caam - fix caam_jr_alloc() ret code 2016-06-01 12:15:49 -07:00
jr.h
Kconfig
key_gen.c crypto: caam - fix signals handling 2017-07-21 07:44:59 +02:00
key_gen.h
Makefile
pdb.h
regs.h
sg_sw_sec4.h