Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: f24679c855400cb306f543bf353f102b9120ba7a
      
https://github.com/tianocore/edk2/commit/f24679c855400cb306f543bf353f102b9120ba7a
  Author: Ansen Huang <[email protected]>
  Date:   2026-08-27 (Thu, 27 Aug 2026)

  Changed paths:
    M MdeModulePkg/Universal/Variable/Pei/Variable.c

  Log Message:
  -----------
  MdeModulePkg: Skip deleted vars in PeiVariable index table searches

The Variable PEIM's index table optimization search path incorrectly
returns deleted variables instead of valid variables when duplicate
variables exist with different states.

This occurs when:

- One variable has deleted state (VAR_IN_DELETED_TRANSITION & VAR_ADDED,
  value 0x3C)
- One variable has valid state (VAR_ADDED, value 0x3F)
- Both variables have the same name and GUID

The function should prioritize and return the valid variable, but the
index table search was returning the first match regardless of state
validity.

In the FindVariableEx() index table traversal, the function was not
properly validating variable states before returning a match. When
CompareWithValidVariable() found a matching variable name and GUID, it
would return immediately without checking if the variable state was
valid (0x3F) or deleted (0x3C).

This issue only affects the index table optimization search path and
does not impact the linear traversal search path. The Variable PEIM
has two main search mechanisms:

1. Linear traversal search - Walks through the entire variable store
checking each header sequentially. This path has correct state
validation logic and is unaffected by this issue.

2. Index table optimization search - Uses a gEfiVariableIndexTableGuid
HOB to quickly jump to variable locations. This optimization is only
active when the platform produces this HOB. This is the path affected
by the issue.

This commit adds explicit state validation in FindVariableEx() to skip
variables with deleted state (0x3C).

Signed-off-by: Michael Kubacki <[email protected]>



To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to