Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752153AbdHHMb2 (ORCPT ); Tue, 8 Aug 2017 08:31:28 -0400 Received: from m12-11.163.com ([220.181.12.11]:58816 "EHLO m12-11.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751880AbdHHMb1 (ORCPT ); Tue, 8 Aug 2017 08:31:27 -0400 From: Pan Bian To: Eric Biederman Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Pan Bian Subject: kexec_file: use crypto_free_shash to free memory Date: Tue, 8 Aug 2017 20:30:40 +0800 Message-Id: <1502195440-3600-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: C8CowAAnlwP6rolZcRLcCQ--.47608S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrKr45ArW7XF15tFy3KFyfJFb_yoWxtrg_Ga y8Jw10vr1jya1DWF47Jw4avry0gw15GF95ur1SqFW8Gry5JwsIvwn3Cr4fCFn8G397AF95 Gr97JFs3Jw42gjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUnjLvtUUUUU== X-Originating-IP: [106.120.213.62] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/xtbBURwuclaDu9FjcgAAs- Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 672 Lines: 25 In function kexec_calculate_store_digests(), kfree() is used to free memory allocated by crypto_alloc_shash(). It is better to use function crypto_free_shash(), which also zeroizes the memory to be freed. Signed-off-by: Pan Bian --- kernel/kexec_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 9f48f44..94eeb38 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -627,7 +627,7 @@ static int kexec_calculate_store_digests(struct kimage *image) out_free_desc: kfree(desc); out_free_tfm: - kfree(tfm); + crypto_free_shash(tfm); out: return ret; } -- 1.9.1