[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <386306.1704296211@warthog.procyon.org.uk>
Date: Wed, 03 Jan 2024 15:36:51 +0000
From: David Howells <dhowells@...hat.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: dhowells@...hat.com, Shigeru Yoshida <syoshida@...hat.com>,
davem@...emloft.net, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: af_alg/hash: Fix uninit-value access in af_alg_free_sg()
Herbert Xu <herbert@...dor.apana.org.au> wrote:
> 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;
Hmmm... Is that going to get you a potential memory leak?
ctx->sgl.sgt.sgl could (in theory) point to an allocated table. I guess that
would be cleaned up by af_alg_free_areq_sgls(), so there's probably no leak
there.
OTOH, af_alg_free_areq_sgls() is going to call af_alg_free_sg(), so maybe we
want to initialise sgl->sgt.sgl to NULL as well.
Does it make sense just to clear *ctx entirely in hash_accept_parent_nokey()?
David
Powered by blists - more mailing lists