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 6D8F37803E8 for ; Mon, 11 Mar 2024 14:02:44 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=v7usET/w9MzGt9sagnimrXg5TUlbI12+bTM8i65pHyY=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20240206; t=1710165763; v=1; b=oEDbWSeH11v4MF2ThKwmDGa/JzRBZv+39lFNWvzfZNwZhodOkc3F8++AFyOQGti7gz7iz2/R jTINQolTQwoYrU6W4Z8L49QZ58kKOqwlR5DNpFkfkSKU4RU1B2VOxX/gJymQlCqbVB0/oYqaFPv 8CnW0U0bgr6pT/3E4s6EdbQ4Cyhpn9SkwRPnldt1m31Pq5AYXn8bXNs+C/47gsJPWYk/FEZbEJr f8UOCNczDchUTcnOSzQsDYueGU4IV/g3EPymzJ3ezuWMj8+eIzJuDTxDhNJo8PcqJX9/zvCOeWf LQTx4Va9jOxmJCaw1B6i8ZIwDeTtK4ty7jCiYP55dsRKg== X-Received: by 127.0.0.2 with SMTP id OuJgYY7687511xwrmaytUeB0; Mon, 11 Mar 2024 07:02:43 -0700 X-Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by mx.groups.io with SMTP id smtpd.web11.63688.1710165761966688176 for ; Mon, 11 Mar 2024 07:02:42 -0700 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id D540CCE10C0 for ; Mon, 11 Mar 2024 14:02:39 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0961EC43394 for ; Mon, 11 Mar 2024 14:02:39 +0000 (UTC) X-Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2d228a132acso56237751fa.0 for ; Mon, 11 Mar 2024 07:02:38 -0700 (PDT) X-Gm-Message-State: 2XuEvjfbddpYiPTUkeSxp7EJx7686176AA= X-Google-Smtp-Source: AGHT+IHZlfyBpLLq4+Y+bwpLnY5UNCXNXnj3iLhlyCX01lNxWpQLjJLQMKKMcZ78/HkRamnuN7kFChYsiCJtvp5CuUM= X-Received: by 2002:a2e:b178:0:b0:2d4:35d6:1984 with SMTP id a24-20020a2eb178000000b002d435d61984mr2476338ljm.6.1710165757083; Mon, 11 Mar 2024 07:02:37 -0700 (PDT) MIME-Version: 1.0 References: <20240228022750.873-1-zhiguang.liu@intel.com> <20240228022750.873-4-zhiguang.liu@intel.com> In-Reply-To: <20240228022750.873-4-zhiguang.liu@intel.com> From: "Ard Biesheuvel" Date: Mon, 11 Mar 2024 07:02:42 -0700 X-Gmail-Original-Message-ID: Message-ID: 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 , Laszlo Ersek , Sami Mujawar 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,ardb@kernel.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=oEDbWSeH; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (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 Wed, 28 Feb 2024 at 03:28, 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. > > 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(-) > Reviewed-by: Ard Biesheuvel > 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 = &MmiEntry->MmiHandlers; > } > > - for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) { > + for (Link = Head->ForwardLink; Link != Head;) { > MmiHandler = 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 = Link->ForwardLink; > Status = MmiHandler->Handler ( > (EFI_HANDLE)MmiHandler, > Context, > -- > 2.31.1.windows.1 > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116629): https://edk2.groups.io/g/devel/message/116629 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] -=-=-=-=-=-=-=-=-=-=-=-