public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/2] RedfishPkg/RedfishRestExDxe: fix driver binding stop issue.
@ 2023-02-10 12:33 Nickle Wang
  2023-02-11  8:17 ` Chang, Abner
  0 siblings, 1 reply; 2+ messages in thread
From: Nickle Wang @ 2023-02-10 12:33 UTC (permalink / raw)
  To: devel; +Cc: Abner Chang, Igor Kulchytskyy, Nick Ramirez

RedfishRestExDriverBindingStop() does not uninstall service
binding protocol and release resource because:
- RestExDestroyChildEntryInHandleBuffer() does not remove entry
when NetIsInHandleBuffer() return false. So the linked list
is not empty.
- When NumberOfChildrenis 0, binding stop function return in the
NetLibGetNicHandle() condition check and never reach to the reset
of code in driver binding stop.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
---
 RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c
index ad65ae213a..7036aed426 100644
--- a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c
+++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c
@@ -3,6 +3,7 @@
 
   Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
   (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -57,6 +58,7 @@ RestExDestroyChildEntryInHandleBuffer (
   ChildHandleBuffer = ((RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ChildHandleBuffer;
 
   if (!NetIsInHandleBuffer (Instance->ChildHandle, NumberOfChildren, ChildHandleBuffer)) {
+    RemoveEntryList (&Instance->Link);
     return EFI_SUCCESS;
   }
 
@@ -563,7 +565,7 @@ RedfishRestExDriverBindingStop (
                                   );
   }
 
-  if ((NumberOfChildren == 0) && IsListEmpty (&RestExSb->RestExChildrenList)) {
+  if (IsListEmpty (&RestExSb->RestExChildrenList)) {
     gBS->UninstallProtocolInterface (
            NicHandle,
            &gEfiRestExServiceBindingProtocolGuid,
-- 
2.39.1.windows.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] RedfishPkg/RedfishRestExDxe: fix driver binding stop issue.
  2023-02-10 12:33 [PATCH 1/2] RedfishPkg/RedfishRestExDxe: fix driver binding stop issue Nickle Wang
@ 2023-02-11  8:17 ` Chang, Abner
  0 siblings, 0 replies; 2+ messages in thread
From: Chang, Abner @ 2023-02-11  8:17 UTC (permalink / raw)
  To: Nickle Wang, devel@edk2.groups.io; +Cc: Igor Kulchytskyy, Nick Ramirez

[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang@amd.com>

> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Friday, February 10, 2023 8:34 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> <igork@ami.com>; Nick Ramirez <nramirez@nvidia.com>
> Subject: [PATCH 1/2] RedfishPkg/RedfishRestExDxe: fix driver binding stop
> issue.
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> RedfishRestExDriverBindingStop() does not uninstall service binding protocol
> and release resource because:
> - RestExDestroyChildEntryInHandleBuffer() does not remove entry when
> NetIsInHandleBuffer() return false. So the linked list is not empty.
> - When NumberOfChildrenis 0, binding stop function return in the
> NetLibGetNicHandle() condition check and never reach to the reset of code
> in driver binding stop.
> 
> Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Nick Ramirez <nramirez@nvidia.com>
> ---
>  RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c
> b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c
> index ad65ae213a..7036aed426 100644
> --- a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c
> +++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c
> @@ -3,6 +3,7 @@
> 
>    Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
>    (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
> +  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> 
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -57,6 +58,7 @@ RestExDestroyChildEntryInHandleBuffer (
>    ChildHandleBuffer =
> ((RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)-
> >ChildHandleBuffer;
> 
>    if (!NetIsInHandleBuffer (Instance->ChildHandle, NumberOfChildren,
> ChildHandleBuffer)) {
> +    RemoveEntryList (&Instance->Link);
>      return EFI_SUCCESS;
>    }
> 
> @@ -563,7 +565,7 @@ RedfishRestExDriverBindingStop (
>                                    );
>    }
> 
> -  if ((NumberOfChildren == 0) && IsListEmpty (&RestExSb-
> >RestExChildrenList)) {
> +  if (IsListEmpty (&RestExSb->RestExChildrenList)) {
>      gBS->UninstallProtocolInterface (
>             NicHandle,
>             &gEfiRestExServiceBindingProtocolGuid,
> --
> 2.39.1.windows.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-11  8:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-10 12:33 [PATCH 1/2] RedfishPkg/RedfishRestExDxe: fix driver binding stop issue Nickle Wang
2023-02-11  8:17 ` Chang, Abner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox