Skip to content

Commit

Permalink
crypto: rk3288 - Fix use after free in unprepare
Browse files Browse the repository at this point in the history
commit c0afb6b upstream.

The unprepare call must be carried out before the finalize call
as the latter can free the request.

Fixes: c66c17a ("crypto: rk3288 - Remove prepare/unprepare request")
Reported-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
herbertx authored and gregkh committed Apr 3, 2024
1 parent b466416 commit eb2a41a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/crypto/rockchip/rk3288_crypto_ahash.c
Expand Up @@ -332,12 +332,12 @@ static int rk_hash_run(struct crypto_engine *engine, void *breq)
theend:
pm_runtime_put_autosuspend(rkc->dev);

rk_hash_unprepare(engine, breq);

local_bh_disable();
crypto_finalize_hash_request(engine, breq, err);
local_bh_enable();

rk_hash_unprepare(engine, breq);

return 0;
}

Expand Down

0 comments on commit eb2a41a

Please sign in to comment.