From: Herbert Xu Date: Tue, 1 Jan 2008 04:44:50 +0000 (+1100) Subject: [CRYPTO] xcbc: Fix algorithm leak when block size check fails X-Git-Tag: MMI-PSA29.97-13-9~37728^2~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1b87887d6c232becba77835b29a424cf78442b7d;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [CRYPTO] xcbc: Fix algorithm leak when block size check fails When the underlying algorithm has a block size other than 16 we abort without freeing it. In fact, we try to return the algorithm itself as an error! This patch plugs the leak and makes it return -EINVAL instead. Signed-off-by: Herbert Xu --- diff --git a/crypto/xcbc.c b/crypto/xcbc.c index 789cdeee6b7d..e3d9503a034b 100644 --- a/crypto/xcbc.c +++ b/crypto/xcbc.c @@ -307,7 +307,8 @@ static struct crypto_instance *xcbc_alloc(struct rtattr **tb) case 16: break; default: - return ERR_PTR(PTR_ERR(alg)); + inst = ERR_PTR(-EINVAL); + goto out_put_alg; } inst = crypto_alloc_instance("xcbc", alg);