From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id E21A9D80CAA for ; Mon, 30 Oct 2023 07:49:32 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=bpkIPlSJZuetUoQRpRtRQNA+vefEwvOpdPtLeKqqD+Q=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1698652171; v=1; b=dBMKx36Vih6YJsErnsCQAKtdHz7uZLwtEP8PFBtElUHZwiLS/NHYfhg/aiNYTA/wy/FsEltd 02kNLbDfeJg9cdv4GtMUNxv3riElWwHTRQSZjY55zpknGJe4Ekp7wqVmfwjpNZ9hgZ9ZB3OE35O 39TITZQ2rp8MnBcVg9h5ShYE= X-Received: by 127.0.0.2 with SMTP id mVexYY7687511xdDwZ3OOiZL; Mon, 30 Oct 2023 00:49:31 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.143793.1698652164261209974 for ; Mon, 30 Oct 2023 00:49:31 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="419138578" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="419138578" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 00:49:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="736666726" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="736666726" X-Received: from shpfwdbuild003.ccr.corp.intel.com ([10.239.56.82]) by orsmga006.jf.intel.com with ESMTP; 30 Oct 2023 00:49:28 -0700 From: "Xu, Wei6" To: devel@edk2.groups.io Cc: Wei6 Xu , Laszlo Ersek , Ard Biesheuvel , Sami Mujawar , Ray Ni Subject: [edk2-devel] [PATCH v3 2/4] StandaloneMmPkg/Core: Fix potential memory leak issue Date: Mon, 30 Oct 2023 15:49:16 +0800 Message-Id: <612df6233746ce55990359472221a193c398749b.1698651605.git.wei6.xu@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,wei6.xu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ul9PQzkMleH8wv0wfmWDnlgax7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=dBMKx36V; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none) In MmCoreFfsFindMmDriver(), ScratchBuffer is not freed in the error return path that DstBuffer page allocation fails. Free ScratchBuffer before return with error. Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Sami Mujawar Cc: Ray Ni Signed-off-by: Wei6 Xu --- StandaloneMmPkg/Core/FwVol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/StandaloneMmPkg/Core/FwVol.c b/StandaloneMmPkg/Core/FwVol.c index e1e20ffd14ac..9d0ce66ef839 100644 --- a/StandaloneMmPkg/Core/FwVol.c +++ b/StandaloneMmPkg/Core/FwVol.c @@ -150,6 +150,7 @@ MmCoreFfsFindMmDriver ( //=0D DstBuffer =3D (VOID *)(UINTN)AllocatePages (EFI_SIZE_TO_PAGES (DstBuff= erSize));=0D if (DstBuffer =3D=3D NULL) {=0D + FreePages (ScratchBuffer, EFI_SIZE_TO_PAGES (ScratchBufferSize));=0D return EFI_OUT_OF_RESOURCES;=0D }=0D =0D --=20 2.29.2.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110298): https://edk2.groups.io/g/devel/message/110298 Mute This Topic: https://groups.io/mt/102270547/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-