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 378FC941435 for ; Wed, 28 Feb 2024 08:47:12 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=GnZNX6JHBIxdOywaXaz0/9tbsnPj+DjCCFgwgYTt+9o=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1709110030; v=1; b=lcJgG97PQDySrWT4/pkbonyC8oPSX7FstS54CH2yBZ4CXMNhFxe+wiFXrbAQQqyjsR7hhXBV iHlqGC3yn8bJ77L0AIafzH9vUyOFz+ZRqltQ5dpjsAVvBQK2kis/YqVaGKrzPhMKYbnLALTSbU8 x0JWCzIh0b3Mu0EVddxOtGYg= X-Received: by 127.0.0.2 with SMTP id LFcLYY7687511xCfGj0IFcM4; Wed, 28 Feb 2024 00:47:10 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.9205.1709110030267968431 for ; Wed, 28 Feb 2024 00:47:10 -0800 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-70-pPr_RcBmMTyrvBEG4nFnUQ-1; Wed, 28 Feb 2024 03:47:07 -0500 X-MC-Unique: pPr_RcBmMTyrvBEG4nFnUQ-1 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22A422803600; Wed, 28 Feb 2024 08:47:07 +0000 (UTC) X-Received: from [10.39.193.212] (unknown [10.39.193.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 082F940C94AB; Wed, 28 Feb 2024 08:47:05 +0000 (UTC) Message-ID: <2bedf9ab-2a55-d032-7009-c78d125c6a7c@redhat.com> Date: Wed, 28 Feb 2024 09:47:05 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v2 3/4] StandaloneMmPkg: Support to unregister MMI handler inside MMI handler To: devel@edk2.groups.io, zhiguang.liu@intel.com Cc: Liming Gao , Jiaxin Wu , Ray Ni , Ard Biesheuvel , Sami Mujawar References: <20240228022750.873-1-zhiguang.liu@intel.com> <20240228022750.873-4-zhiguang.liu@intel.com> From: "Laszlo Ersek" In-Reply-To: <20240228022750.873-4-zhiguang.liu@intel.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: W3NjfYJmkPS2zx6nQ27MmC2Zx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 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=lcJgG97P; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 2/28/24 03:27, Zhiguang Liu wrote: > To support unregister MMI handler inside MMI handler itself, > get next node before MMI handler is executed, since LIST_ENTRY that > Link points to may be freed if unregister MMI handler in MMI handler > itself. >=20 > Cc: Liming Gao > Cc: Jiaxin Wu > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Ard Biesheuvel > Cc: Sami Mujawar > Signed-off-by: Zhiguang Liu > --- > StandaloneMmPkg/Core/Mmi.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) >=20 > diff --git a/StandaloneMmPkg/Core/Mmi.c b/StandaloneMmPkg/Core/Mmi.c > index 0de6fd17fc..c1a1d76e85 100644 > --- a/StandaloneMmPkg/Core/Mmi.c > +++ b/StandaloneMmPkg/Core/Mmi.c > @@ -154,9 +154,14 @@ MmiManage ( > Head =3D &MmiEntry->MmiHandlers; > } > =20 > - for (Link =3D Head->ForwardLink; Link !=3D Head; Link =3D Link->Forwar= dLink) { > + for (Link =3D Head->ForwardLink; Link !=3D Head;) { > MmiHandler =3D CR (Link, MMI_HANDLER, Link, MMI_HANDLER_SIGNATURE); > - > + // > + // To support unregister MMI handler inside MMI handler itself, > + // get next node before handler is executed, since LIST_ENTRY that > + // Link points to may be freed if unregister MMI handler. > + // > + Link =3D Link->ForwardLink; > Status =3D MmiHandler->Handler ( > (EFI_HANDLE)MmiHandler, > Context, Reviewed-by: Laszlo Ersek -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116102): https://edk2.groups.io/g/devel/message/116102 Mute This Topic: https://groups.io/mt/104616994/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-