]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: user - Fix crypto_alg_match race
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 7 Apr 2015 13:27:01 +0000 (21:27 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 10 Dec 2019 18:01:32 +0000 (18:01 +0000)
commitea8e4f792da5652f23481231e252f06221b73445
tree73abd280531470a41a44d13c638164f98df87387
parent914927c7bac4ecd2351bdee0cd5b2b1c11150342
crypto: user - Fix crypto_alg_match race

commit 016baaa1183bb0c5fb2a7de42413bba8a51c1bc8 upstream.

The function crypto_alg_match returns an algorithm without taking
any references on it.  This means that the algorithm can be freed
at any time, therefore all users of crypto_alg_match are buggy.

This patch fixes this by taking a reference count on the algorithm
to prevent such races.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
crypto/crypto_user.c