crypto: api - Redo lookup on EEXIST
authorHerbert Xu <herbert@gondor.apana.org.au>
Mon, 19 May 2025 10:29:38 +0000 (18:29 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 23 May 2025 11:25:47 +0000 (19:25 +0800)
commit0a3cf32da469ff1df6e016f5f82b439a63d14461
tree5d3c34261c15bdf3b237a9133b76b33d8fcbf5ee
parent35de409aa30269a3b106fe957a95f7a2b7e21a60
crypto: api - Redo lookup on EEXIST

When two crypto algorithm lookups occur at the same time with
different names for the same algorithm, e.g., ctr(aes-generic)
and ctr(aes), they will both be instantiated.  However, only one
of them can be registered.  The second instantiation will fail
with EEXIST.

Avoid failing the second lookup by making it retry, but only once
because there are tricky names such as gcm_base(ctr(aes),ghash)
that will always fail, despite triggering instantiation and EEXIST.

Reported-by: Ingo Franzki <ifranzki@linux.ibm.com>
Fixes: 2825982d9d66 ("[CRYPTO] api: Added event notification")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/api.c