]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cypto: mediatek - fix leaks in mtk_desc_ring_alloc
authorXiaoliang Pang <dawning.pang@gmail.com>
Mon, 14 Sep 2020 03:00:51 +0000 (11:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:07:22 +0000 (10:07 +0100)
commitaee35828de8859987cc24d0fbc189ffbfe1e3568
treef191721403d91362bf08959ceab8e012d0daad21
parentabfdbdda990a5807700feb8e7527a212e568d615
cypto: mediatek - fix leaks in mtk_desc_ring_alloc

[ Upstream commit 228d284aac61283cde508a925d666f854b57af63 ]

In the init loop, if an error occurs in function 'dma_alloc_coherent',
then goto the err_cleanup section, after run i--,
in the array ring, the struct mtk_ring with index i will not be released,
causing memory leaks

Fixes: 785e5c616c849 ("crypto: mediatek - Add crypto driver support for some MediaTek chips")
Cc: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Xiaoliang Pang <dawning.pang@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/mediatek/mtk-platform.c