]> git.karo-electronics.de Git - karo-tx-linux.git/commit
crypto: api - Fix algorithm test race that broke aead initialisation
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 28 Jan 2009 03:09:59 +0000 (14:09 +1100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Mar 2009 00:32:45 +0000 (17:32 -0700)
commit604fcaf3c3a78df2f43564d8f37d0e254a59e62e
treed2783344d9851faf4d8f1dc8f7adbb6645e03307
parent90a2a0f6ecc8bfe5994043661efb938583c0a2c1
crypto: api - Fix algorithm test race that broke aead initialisation

commit b8e15992b420d09dae831125a623c474c8637cee upstream.

When we complete a test we'll notify everyone waiting on it, drop
the mutex, and then remove the test larval (after reacquiring the
mutex).  If one of the notified parties tries to register another
algorithm with the same driver name prior to the removal of the
test larval, they will fail with EEXIST as only one algorithm of
a given name can be tested at any time.

This broke the initialisation of aead and givcipher algorithms as
they will register two algorithms with the same driver name, in
sequence.

This patch fixes the problem by marking the larval as dead before
we drop the mutex, and also ignoring all dead or dying algorithms
on the registration path.

Tested-by: Andreas Steffen <andreas.steffen@strongswan.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Kerin Millar <kerframil@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
crypto/algapi.c