Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3063562imw; Mon, 11 Jul 2022 00:30:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uNayoTeTo0kaLCWzqlKJEP+Ia7E328FlXHJwQ1KgFDLEywRiWoe5pGepVqYGqYauRz5/RN X-Received: by 2002:a17:907:3f14:b0:726:9f27:ad36 with SMTP id hq20-20020a1709073f1400b007269f27ad36mr17506961ejc.659.1657524631331; Mon, 11 Jul 2022 00:30:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657524631; cv=none; d=google.com; s=arc-20160816; b=fy9QBDGg8mMsYnsn6Vbw6Y71jDXtR5D/SfyyBwHmqE+6Y+bVp079497sgz56PbROPR gg+t0BjsYzuJ/jJrPZa2gggorHUn6vHzMzq5OAZqKLxx1tn5UiYFjDgK3aR9tuzM/dWa XCWJpG41PLegFUv463nluDM5f2Ltpzl4yi9ZYsFYXBfCMjkvideSwQhsaVxFR8EfUyQs xHWlCTPLBCdnwDnKIvQt52/fBzPozOo1oVRO+69p+hAzZvlBoHvFVmsImBe6iRpwsem1 VJNwaP8R65Od3HkhIwxWvcpEwePj5DjUT+CzwBYbcm04rFIlrMv+6XBV6GSM8u18kN/e hiHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=AH2EzWZfnJV6fIlvat5MXanKCwJ4URf7qbM1gSDXMpI=; b=yeNNaFEwsIAjZAW5AryGEWum3z3aJG0OHoGnfjSBiZcIFoBkqO0O/Jua9US3+r4Vxw asXQ9XZBSk6hcOOYCWolXdbDli9wdBd0SFR4HfKzPow0HxmbmyxrCXUVZ79AWO5hiTpk K7t8ssnL8I7aiY1RryWUolh/fmV+2yl6FifyKdE4y26NydcbhCD4KL3iwp73ShSZ5hhH k6jg2UOWtCWXS/Mks/S8SfbEWwJcp3RaSGSoQv1o3jrsRZFVsQ5vcfjVnOHlsBdaDR9G ed+dj8IOSrAaQjmVtBvEGQfnuueMxBOXMEG/9Q90HQ9hoxmJX7M8w0vL0waerAl1nhZR Z8sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=G4RNUrAD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k19-20020a17090632d300b00722e6c16c85si8408726ejk.969.2022.07.11.00.30.06; Mon, 11 Jul 2022 00:30:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=G4RNUrAD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230095AbiGKHWw (ORCPT + 99 others); Mon, 11 Jul 2022 03:22:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbiGKHWv (ORCPT ); Mon, 11 Jul 2022 03:22:51 -0400 Received: from mail-m971.mail.163.com (mail-m971.mail.163.com [123.126.97.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5DCB41055F; Mon, 11 Jul 2022 00:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=AH2Ez WZfnJV6fIlvat5MXanKCwJ4URf7qbM1gSDXMpI=; b=G4RNUrAD7r0CRtlLAAib5 sRtXfps0BpUR+wIHr92y0A5J5zsfltOS2VKQQGYk9gTvfR2I3zmInh+PokMhzJqK I+4InpAN1vrUyHIi2hIg6hKRQG1j8AAPJNZdU6yxdyJl9y2eacwJB8ez1bNf2Fc3 BhxNPLKsTa2yzSn66+MtZA= Received: from localhost.localdomain (unknown [123.112.69.106]) by smtp1 (Coremail) with SMTP id GdxpCgBnpeabz8tisz21Ng--.19861S4; Mon, 11 Jul 2022 15:22:16 +0800 (CST) From: Jianglei Nie To: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, jmorris@namei.org, serge@hallyn.com Cc: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Jianglei Nie Subject: [PATCH] ima/evm: Fix potential memory leak in ima_init_crypto() Date: Mon, 11 Jul 2022 15:22:02 +0800 Message-Id: <20220711072202.2319030-1-niejianglei2021@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GdxpCgBnpeabz8tisz21Ng--.19861S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrtFWfKFy8ZF1fCw48CFWxJFb_yoWxuFgE9a s0934xW3W7Zan3ZayjvFZ7ZF4vgrZ5XFyFgr9IywnruFy3Cr45Xa47Xrs3Jry8AryUAF4q ga98JFW2kwnFgjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xREs2-3UUUUU== X-Originating-IP: [123.112.69.106] X-CM-SenderInfo: xqlhyxxdqjzvrlsqjii6rwjhhfrp/xtbBOQg7jF-PObrQ9QAAsw X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds the missing kfree() for ima_algo_array allocated by kcalloc() to avoid potential memory leak. Signed-off-by: Jianglei Nie --- security/integrity/ima/ima_crypto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c index a7206cc1d7d1..64499056648a 100644 --- a/security/integrity/ima/ima_crypto.c +++ b/security/integrity/ima/ima_crypto.c @@ -205,6 +205,7 @@ int __init ima_init_crypto(void) crypto_free_shash(ima_algo_array[i].tfm); } + kfree(ima_algo_array); out: crypto_free_shash(ima_shash_tfm); return rc; -- 2.25.1