Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: iaa - Remove potential infinite loop in check_completion()

For iaa_crypto operations, it's assumed that if an operation doesn't
make progress, the IAA watchdog timer will kick in and set the
completion status bit to failure and the reason to completion timeout.

Some systems may have broken hardware that doesn't even do that, which
can result in an infinite status-checking loop. Add a check for that
in the loop, and disable the driver if it occurs.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Zanussi, Tom and committed by
Herbert Xu
8c5459f1 8b6c1e46

+10
+10
drivers/crypto/intel/iaa/iaa_crypto_main.c
··· 945 945 bool only_once) 946 946 { 947 947 char *op_str = compress ? "compress" : "decompress"; 948 + int status_checks = 0; 948 949 int ret = 0; 949 950 950 951 while (!comp->status) { 951 952 if (only_once) 952 953 return -EAGAIN; 953 954 cpu_relax(); 955 + if (status_checks++ >= IAA_COMPLETION_TIMEOUT) { 956 + /* Something is wrong with the hw, disable it. */ 957 + dev_err(dev, "%s completion timed out - " 958 + "assuming broken hw, iaa_crypto now DISABLED\n", 959 + op_str); 960 + iaa_crypto_enabled = false; 961 + ret = -ETIMEDOUT; 962 + goto out; 963 + } 954 964 } 955 965 956 966 if (comp->status != IAX_COMP_SUCCESS) {