]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: af_alg - fix NULL pointer dereference in
authorEric Biggers <ebiggers@google.com>
Tue, 28 Nov 2017 08:46:24 +0000 (00:46 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 29 Nov 2017 02:39:14 +0000 (13:39 +1100)
commit2470c6761842e52dfc5c32a567fa31224919c8ec
treecadb413b15f8fd9699ad3f48638795a7bb9fb31e
parent428d4a119a1411db52ae0ff7d2fec306d4027289
crypto: af_alg - fix NULL pointer dereference in

 af_alg_free_areq_sgls()

If allocating the ->tsgl member of 'struct af_alg_async_req' failed,
during cleanup we dereferenced the NULL ->tsgl pointer in
af_alg_free_areq_sgls(), because ->tsgl_entries was nonzero.

Fix it by only freeing the ->tsgl list if it is non-NULL.

This affected both algif_skcipher and algif_aead.

Fixes: b20f04c9fab9 ("crypto: algif_skcipher - overhaul memory management")
Fixes: ba7dd698d9f6 ("crypto: algif_aead - overhaul memory management")
Reported-by: syzbot <syzkaller@googlegroups.com>
Cc: <stable@vger.kernel.org> # v4.14+
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/af_alg.c