Re: [PATCH] crypto: af_alg/hash: Fix uninit-value access in af_alg_free_sg()

From: Herbert Xu
Date: Thu Dec 21 2023 - 22:42:58 EST


On Mon, Dec 11, 2023 at 10:59:49PM +0900, Shigeru Yoshida wrote:
>
> Fixes: c662b043cdca ("crypto: af_alg/hash: Support MSG_SPLICE_PAGES")

I think it should actually be

b6d972f6898308fbe7e693bf8d44ebfdb1cd2dc4
crypto: af_alg/hash: Fix recvmsg() after sendmsg(MSG_MORE)

Anyway, I think we should fix it by adding a new goto label that
does not free the SG list:

unlock_free:
af_alg_free_sg(&ctx->sgl);
<--- Add new label here
hash_free_result(sk, ctx);
ctx->more = false;
goto unlock;

Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt