• Herbert Xu's avatar
    crypto: api - Keep failed instances alive · eb02c38f
    Herbert Xu authored
    This patch reverts commit 9c521a20 ("crypto: api - remove
    instance when test failed") and fixes the underlying problem
    in a different way.
    
    To recap, prior to the reverted commit, an instance that fails
    a self-test is kept around.  However, it would satisfy any new
    lookups against its name and therefore the system may accumlulate
    an unbounded number of failed instances for the same algorithm
    name.
    
    The reverted commit fixed it by unregistering the instance.  Hoever,
    this still does not prevent the creation of the same failed instance
    over and over again each time the name is looked up.
    
    This patch fixes it by keeping the failed instance around, just as
    we would if it were a normal algorithm.  However, the lookup code
    has been udpated so that we do not attempt to create another
    instance as long as this failed one is still registered.  Of course,
    you could still force a new creation by deleting the instance from
    user-space.
    
    A new error (ELIBBAD) has been commandeered for this purpose and
    will be returned when all registered algorithm of a given name
    have failed the self-test.
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    eb02c38f
algapi.c 22.2 KB